1.前端如果用xlsx格式接收表格
后台用XSSFWorkbook workbook = new XSSFWorkbook();创建工作薄
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.addHeader("Content-Disposition", "attachment;filename=fileName" + ".xlsx");
2.前端如果用xls格式接收表格
后台 用HSSFWorkbook workbook = new HSSFWorkbook();创建工作薄
response.setContentType("application/vnd.ms-excel");
response.addHeader("Content-Disposition", "attachment;filename=fileName"+".xls");