From 29d3490e983cadd2b2107486214488e382a72fcc Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期日, 14 十二月 2025 22:21:33 +0800
Subject: [PATCH] 修改了对应代码
---
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
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 726f14b..3abe6b0 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
@@ -912,10 +912,12 @@
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setFillForegroundColor(excel.headerBackgroundColor().index);
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+ // 璁剧疆琛ㄥご鑷姩鎹㈣
+ style.setWrapText(true);
Font headerFont = wb.createFont();
headerFont.setFontName("Arial");
headerFont.setFontHeightInPoints((short) 10);
- headerFont.setBold(true);
+ headerFont.setBold(false);
headerFont.setColor(excel.headerColor().index);
style.setFont(headerFont);
// 璁剧疆琛ㄦ牸澶村崟鍏冩牸鏂囨湰褰㈠紡
@@ -1054,7 +1056,7 @@
}
else if (ColumnType.IMAGE == attr.cellType())
{
- ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1), cell.getRow().getRowNum() + 1);
+ ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1), cell.getRow().getRowNum() + 1);
String propertyValue = Convert.toStr(value);
if (StringUtils.isNotEmpty(propertyValue))
{
@@ -1145,8 +1147,8 @@
Cell cell = null;
try
{
- // 璁剧疆琛岄珮
- row.setHeight(maxHeight);
+ // 璁剧疆琛岄珮涓鸿嚜鍔ㄨ皟鏁�
+ row.setHeight((short) -1);
// 鏍规嵁Excel涓缃儏鍐靛喅瀹氭槸鍚﹀鍑�,鏈変簺鎯呭喌闇�瑕佷繚鎸佷负绌�,甯屾湜鐢ㄦ埛濉啓杩欎竴鍒�.
if (attr.isExport())
{
@@ -1658,7 +1660,7 @@
*/
public void createWorkbook()
{
- this.wb = new SXSSFWorkbook(500);
+ this.wb = new HSSFWorkbook();
this.sheet = wb.createSheet();
wb.setSheetName(0, sheetName);
this.styles = createStyles(wb);
--
Gitblit v1.9.1