diff --git a/src/main/java/com/space/utils/excel/ExcelUtils.java b/src/main/java/com/space/utils/excel/ExcelUtils.java index 8500850..df20026 100644 --- a/src/main/java/com/space/utils/excel/ExcelUtils.java +++ b/src/main/java/com/space/utils/excel/ExcelUtils.java @@ -180,7 +180,9 @@ public static void exportExcel(String file) throws Exception { * @param resp * @throws Exception */ - public static void export(HttpServletResponse resp) throws Exception { + public static void export(HttpServletResponse resp, String filename) throws Exception { + resp.setHeader("Content-disposition", "attachment; filename=" + filename + ".xlsx"); + resp.setContentType("application/msexcel"); OutputStream fileOut = resp.getOutputStream(); wb.write(fileOut); fileOut.close();