Java生成excel需要注意的问题
1.HSSF 生成的是xls后缀的文件
Response需要设置response.setContentType(“application/vnd.ms-excel”);
response.setCharacterEncoding(“utf-8”);
response.setHeader(“Content-dispositon”,“attachment;filename=”+URLEncoder.encode(“测试结果”,“UTF-8”)+".xlsx");
2.XSSF 生成的是xls后缀的文件
Respone需要设置 response.setContentType(“application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”);
response.setCharacterEncoding(“utf-8”);
response.setHeader(“Content-dispositon”,“attachment;filename=”+URLEncoder.encode(“测试结果”,“UTF-8”)+".xlsx");