From 86ca404dbf5f7b3500bc6bedfd07f11c25b1baed Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 22 Mar 2024 16:44:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=A1=A8=E6=A0=BC=E5=A4=B4?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E6=96=87=E6=9C=AC=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index a2c8cc9c..5dea9c8c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -848,6 +848,9 @@ public class ExcelUtil headerFont.setBold(true); headerFont.setColor(excel.headerColor().index); style.setFont(headerFont); + // 设置表格头单元格文本形式 + DataFormat dataFormat = wb.createDataFormat(); + style.setDataFormat(dataFormat.getFormat("@")); headerStyles.put(key, style); } }