1234567891011121314151617181920212223242526272829303132333435363738 |
- package com.jkcredit.invoice.util;
- import javax.servlet.http.HttpServletResponse;
- /**
- * @description:
- * @author: sunzhaoning
- * @create: 2019-05-31 09:16
- * @version: V1.0
- **/
- public class DownExcelTemplateUtil {
- public static void downloadExcel(HttpServletResponse response,String fileName) {
- /* try {
- // 读到流中
- //文件的存放路径
- // InputStream inStream = new FileInputStream( CommonConstants.BASE_PATH + CommonConstants.TEMPLATE_PATH +fileName);
- // 设置输出的格式
- response.reset();
- response.setContentType("bin");
- response.addHeader("Content-Disposition",
- "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
- // 循环取出流中的数据
- byte[] b = new byte[200];
- int len;
- while ((len = inStream.read(b)) > 0) {
- response.getOutputStream().write(b, 0, len);
- }
- inStream.close();
- } catch (IOException e) {
- e.printStackTrace();
- }*/
- }
- }
|