From 6df4c8e3f43f4226013cf2c6ce699208f293be9b Mon Sep 17 00:00:00 2001 From: twelvet <2471835953@qq.com> Date: Sun, 6 Aug 2023 19:14:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=A8=E5=9F=9F=E6=97=A0=E6=B3=95=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=88=B0=E5=90=8E=E7=AB=AF=E8=BF=94=E5=9B=9E=E7=9A=84?= =?UTF-8?q?Content-Disposition=E6=96=87=E4=BB=B6=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit response.headers['content-disposition']; 不加此设置返回的流在跨域时前端无法读取 --- .../plugin/excel/handler/AbstractSheetWriteHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/pig4cloud/plugin/excel/handler/AbstractSheetWriteHandler.java b/src/main/java/com/pig4cloud/plugin/excel/handler/AbstractSheetWriteHandler.java index 151d4ab..9124dbb 100644 --- a/src/main/java/com/pig4cloud/plugin/excel/handler/AbstractSheetWriteHandler.java +++ b/src/main/java/com/pig4cloud/plugin/excel/handler/AbstractSheetWriteHandler.java @@ -93,6 +93,7 @@ public void export(Object o, HttpServletResponse response, ResponseExcel respons .map(MediaType::toString) .orElse("application/vnd.ms-excel"); response.setContentType(contentType); + response.setHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, HttpHeaders.CONTENT_DISPOSITION); response.setCharacterEncoding("utf-8"); response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename*=utf-8''" + fileName); write(o, response, responseExcel);