public void exportTemp(String fileName, String sheetName, Class<?> clz, HttpServletResponse response) throws Exception {
response.addHeader("Content-Disposition", String.format("attachment;fileName=\"%s\"", new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1)));
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");
OutputStream out = response.getOutputStream();
ExcelWriter excelWriter = EasyExcel.write(out, clz).build();
WriteSheet writeSheet = EasyExcel.writerSheet(sheetName).build();
excelWriter.write(null, writeSheet);
excelWriter.finish();
out.flush();
out.close();
}
12-23
1567
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-18
6425
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-07
624
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-09
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-23
4265
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交