Easyexcel 导出数据 发现“数据导出 2024-05-14_15-14-05.xlsx”中的部分内容有问题。是否让我们尽量尝试恢复?如果您信任此工作薄的源,请单击“是”。
这个问题看三个地方:
response的ContentType,文件后缀,EasyExcel的excelType()。
如果文件后缀是xls:
response.setContentType("application/vnd.ms-excel");
EasyExcel.write(response.getOutputStream())
.excelType(ExcelTypeEnum.XLS)
如果文件后缀是xlsx:
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
EasyExcel.write(response.getOutputStream())
.excelType(ExcelTypeEnum.XLSX)