POI导出xlsx
导出xlsx格式:
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.addHeader("Content-Disposition", "attachment;filename=fileName" + ".xlsx");
创建工作薄的时候,用Workbook workbook = new XSSFWorkbook();
这样可以正常导出xlsx格式
vue前端也要相应的修改contentType
导出xls格式:
response.setContentType("application/vnd.ms-excel");
response.addHeader("Content-Disposition", "attachment;filename=fileName"+".xls");
创建工作薄的时候,用Workbook workbook = new HSSFWorkbook();