From 22ed3454ba4e70ee01afcf6717758ed810c6478c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Fri, 3 Apr 2026 11:28:39 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=97=E7=AC=A6=E5=A4=A7=E4=BA=8E255?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/dromara/common/excel/core/ExcelDownHandler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/ExcelDownHandler.java b/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/ExcelDownHandler.java index 00d9b98b6..36d4d0de6 100644 --- a/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/ExcelDownHandler.java +++ b/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/ExcelDownHandler.java @@ -130,8 +130,9 @@ public class ExcelDownHandler implements SheetWriteHandler { } if (ObjectUtil.isNotEmpty(options)) { // 仅当下拉可选项不为空时执行 - if (options.size() > 20) { - // 这里限制如果可选项大于20,则使用额外表形式 + int totalCharacter = options.stream().mapToInt(String::length).sum() + options.size(); + if (options.size() > 20 || totalCharacter > 255) { + // 这里限制如果可选项大于20 或 总字符数超过255,则使用额外表形式 dropDownWithSheet(helper, workbook, sheet, index, options); } else { // 否则使用固定值形式