From e1ae7dc7fbde272b03cb59cd1344bb87ec2e6fa2 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 13 Apr 2023 15:41:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=AE=9A=E6=97=B6=E6=8A=A5=E5=91=8A):=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=A7=86=E5=9B=BE=E5=90=8D=E7=A7=B0=E5=8C=85?= =?UTF-8?q?=E5=90=AB"/"=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/io/dataease/commons/utils/ExcelUtils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/src/main/java/io/dataease/commons/utils/ExcelUtils.java b/backend/src/main/java/io/dataease/commons/utils/ExcelUtils.java index e03382babe..69ed9f81ac 100644 --- a/backend/src/main/java/io/dataease/commons/utils/ExcelUtils.java +++ b/backend/src/main/java/io/dataease/commons/utils/ExcelUtils.java @@ -8,6 +8,8 @@ import io.dataease.commons.model.excel.ExcelSheetModel; import java.util.List; import java.util.concurrent.atomic.AtomicReference; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -29,6 +31,9 @@ public class ExcelUtils { List> details = sheet.getData(); details.add(0, sheet.getHeads()); String sheetName = sheet.getSheetName(); + Pattern pattern = Pattern.compile("[\\s\\\\/:\\*\\?\\\"<>\\|]"); + Matcher matcher = pattern.matcher(sheetName); + sheetName = matcher.replaceAll("-"); Sheet curSheet = wb.createSheet(sheetName); if (StringUtils.isBlank(fileName)) { String cName = sheetName + suffix;