**
esaypoi导出excel后office打开报错
**
使用esaypoi导出excel后office打开报错,提示 ”Excel 无法打开文件“导出表格 (1).xlsx”,因为文件格式或文件扩展名无效。请确定文件未损坏,并且文件扩展名与文件的格式匹配。“
一脸懵逼,于是百度问度娘,大概的方案有以下几种:
1、XSSF的类型response设置为:
response.setContentType(“application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”);
response.setHeader(“Content-Disposition”, “attachment;filename=” + URLEncoder.encode(fileName, “UTF-8”));
查看设置已经是这个了,跳过继续找原因
public static void successExcel(HttpServletResponse response,Workbook workbook,String fileName){
ServletOutputStream out = null;
try{
out = response.getOutpu