3
异常代码
response.setContentType("application/octet-stream");
response.setCharacterEncoding("utf-8");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("导出excel", "UTF-8") + ".xls");
@Cleanup("finish") ExcelWriter excelWriter = EasyExcel.write(new BufferedOutputStream(response.getOutputStream()), RiskPersonExcelOutDTO.class)
.autoCloseStream(Boolean.TRUE).excelType(ExcelTypeEnum.XLSX).needHead(Boolean.TRUE)
.password("a123456").build();
//初始化sheet
WriteSheet writeSheet = EasyExcel.writerSheet().build();
writeSheet.setSheetNo(1);
writeSheet.setSheetName("默认表");
excelWriter.write(list,writeSheet);
异常提示
系统并未出现异常,且加密后的文件一直都是4.0KB