try { //输出流对象 OutputStream os = null; Workbook workbook = null; ...... workbook = ExcelExportUtil.exportExcel(params, excelMap); // 清空response response.reset(); response.addHeader( "Content-Disposition", "attachment;filename=" + "excel_"+new Date().getTime() + ".xls"); response.setContentType("application/force-download"); // response.setContentType("application/octet-stream"); os = response.getOutputStream(); workbook.write(os); os.flush(); return true; } catch (Exception e) { e.printStackTrace(); }
以流形式导出excel
最新推荐文章于 2024-07-12 10:40:33 发布