From 359f1d48b1d859a23cd35a425d2cffb1e9d1c811 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期五, 26 十二月 2025 19:58:59 +0800
Subject: [PATCH] 修改了对应代码

---
 ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java |   55 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java
index 6583feb..842daf6 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java
@@ -287,11 +287,11 @@
                 int column = 0;
                 if(index == 0) {
                     // 鍚堝苟绗竴琛岀殑鍓�5涓崟鍏冩牸
-                    sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 7));
+                    sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
 
                     // 鍒涘缓琛屽苟璁剧疆楂樺害
                      row = sheet.createRow(0);
-                    row.setHeight((short)(40 * 40));
+                    row.setHeight((short)(20 * 20));
 
 
                   //  sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 7));
@@ -301,6 +301,8 @@
                     CellStyle style = wb.createCellStyle();
                     Font font = wb.createFont();
                     font.setBold(true);
+                    font.setFontHeightInPoints((short) 12);
+
                     font.setFontName("瀹嬩綋");
                     style.setFont(font);
                     style.setAlignment(HorizontalAlignment.CENTER);
@@ -308,6 +310,7 @@
                     row = sheet.createRow(1);
                //
                     row.createCell(0).setCellValue("ISO缂栧彿:");
+                    row.createCell(1).setCellValue(list.get(0).getIos5());
                  //   row.createCell(4).setCellValue("妗e彿:");
                     //鎷垮埌妗e彿
                     row.createCell(5).setCellValue("");
@@ -469,21 +472,35 @@
         style.setFont(dataFont);
         styles.put("data", style);
 
-        style = wb.createCellStyle();
-        style.cloneStyleFrom(styles.get("data"));
-        style.setAlignment(HorizontalAlignment.CENTER);
-        style.setVerticalAlignment(VerticalAlignment.CENTER);
-        // 璁剧疆鍗曞厓鏍煎唴瀹硅嚜鍔ㄦ崲琛�
-        style.setWrapText(true);
-        style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
-        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
-        Font headerFont = wb.createFont();
-        headerFont.setFontName("Arial");
-        headerFont.setFontHeightInPoints((short) 10);
-        headerFont.setBold(true);
-        headerFont.setColor(IndexedColors.WHITE.getIndex());
-        style.setFont(headerFont);
-        styles.put("header", style);
+        // 鍒涘缓琛ㄥご鏍峰紡鏄犲皠锛屾牴鎹瓻xcel娉ㄨВ鍔ㄦ�佺敓鎴�
+        Map<String, CellStyle> headerStyles = new HashMap<String, CellStyle>();
+        for (Object[] os : fields)
+        {
+            Excel excel = (Excel) os[1];
+            String key = StringUtils.format("header_{}_{}", excel.headerColor(), excel.headerBackgroundColor());
+            if (!headerStyles.containsKey(key))
+            {
+                 style = wb.createCellStyle();
+                style.cloneStyleFrom(styles.get("data"));
+                style.setAlignment(HorizontalAlignment.CENTER);
+                style.setVerticalAlignment(VerticalAlignment.CENTER);
+                // 璁剧疆鍗曞厓鏍煎唴瀹硅嚜鍔ㄦ崲琛�
+                style.setWrapText(true);
+                // 鏍规嵁娉ㄨВ璁剧疆琛ㄥご鑳屾櫙鑹� - 宸叉敞閲婏紝琛ㄥご涓嶆樉绀鸿儗鏅壊
+                /*if (excel.headerBackgroundColor() != IndexedColors.WHITE) {
+                    style.setFillForegroundColor(excel.headerBackgroundColor().index);
+                    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+                }*/
+                Font headerFont = wb.createFont();
+                headerFont.setFontName("Arial");
+                headerFont.setFontHeightInPoints((short) 10);
+                headerFont.setBold(false);
+                headerFont.setColor(excel.headerColor().index);
+                style.setFont(headerFont);
+                headerStyles.put(key, style);
+            }
+        }
+        styles.putAll(headerStyles);
 
         style = wb.createCellStyle();
         style.setAlignment(HorizontalAlignment.CENTER);
@@ -529,7 +546,9 @@
         // 鍐欏叆鍒椾俊鎭�
         cell.setCellValue(attr.name());
         setDataValidation(attr, row, column);
-        cell.setCellStyle(styles.get("header"));
+        // 鏍规嵁Excel娉ㄨВ鍔ㄦ�侀�夋嫨琛ㄥご鏍峰紡
+        String key = StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor());
+        cell.setCellStyle(styles.get(key));
         return cell;
     }
 

--
Gitblit v1.9.1