From ffa54cddadb29a265869573abb0c1067fcd74b96 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 09 五月 2025 16:14:03 +0800
Subject: [PATCH] 提交

---
 server/system_service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java |   54 +++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/server/system_service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java b/server/system_service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
index 0b02a91..c6f70ac 100644
--- a/server/system_service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
+++ b/server/system_service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
@@ -440,26 +440,25 @@
             Sheet sheet = sxssfWorkbook.createSheet(sheetName);
             // 鍒涘缓鍒楀ご
             sheet.createFreezePane(0, 1);
-            Row header = sheet.createRow(0);
             CellStyle hstyle = configHeaderCellStatic(sxssfWorkbook);
+            CellStyle rowStyle = configDataCellStatic(sxssfWorkbook);
             for (int i = 0; i < dataList.size(); i++) {
-                Cell cell = header.createCell(i);
-                cell.setCellValue(dataList.get(i).get(Constants.ZERO));
-                // 鍒楀璁剧疆
-                sheet.setColumnWidth(i, dataList.get(i).get(Constants.ZERO).length() * 2 * 256);
-                // 璁剧疆鍒楀ご鍗曞厓鏍�
-                cell.setCellStyle(hstyle);
-            }
-
-            //鎬昏鏁�
-            Integer rowSize = dataList.get(Constants.ZERO).size();
-            //鎬诲垪鏁�
-            Integer columnSize = dataList.size();
-            for (int i = 1; i < rowSize; i++) {
                 Row row = sheet.createRow(i);
-                for (int j = 0; j < columnSize; j++) {
+                List<String> rowList = dataList.get(i);
+                for (int j = 0; j < rowList.size(); j++) {
                     Cell cell = row.createCell(j);
-                    cell.setCellValue(dataList.get(j).get(i));
+                    if(i==0&&j==0){
+                        cell.setCellValue("鏁版嵁鏃ユ湡");
+                    }else{
+                        cell.setCellValue(rowList.get(j));
+                    }
+
+                    if(i==0){
+                        sheet.setColumnWidth(i, rowList.get(i).length() * 2 * 256);
+                        cell.setCellStyle(hstyle);
+                    }else if(j==0){
+                        cell.setCellStyle(rowStyle);
+                    }
                 }
             }
             sxssfWorkbook.write(os);
@@ -477,6 +476,7 @@
         }
     }
 
+
     private static CellStyle configHeaderCellStatic (SXSSFWorkbook workbook)  {
         CellStyle style = workbook.createCellStyle();
         style.setAlignment(HorizontalAlignment.CENTER);
@@ -486,7 +486,7 @@
         style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
         // 瀛椾綋
         Font font = workbook.createFont();
-        font.setFontHeightInPoints((short) 12);
+        font.setFontHeightInPoints((short) 10);
         style.setFont(font);
         // 璁剧疆杈规
         configCellBorder(style);
@@ -494,6 +494,26 @@
     }
 
 
+    /**
+     * 閰嶇疆鏁版嵁鍗曞厓鏍�
+     */
+    private static CellStyle configDataCellStatic  (SXSSFWorkbook workbook ) {
+        CellStyle  configDataCellStyle = workbook.createCellStyle();
+        configDataCellStyle.setAlignment(HorizontalAlignment.CENTER);
+        configDataCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        // 璁剧疆鑳屾櫙
+        configDataCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        configDataCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+        // 瀛椾綋
+        Font font = workbook.createFont();
+        font.setFontHeightInPoints((short) 10);
 
+        configDataCellStyle.setFont(font);
+        // 杈规
+        configCellBorder(configDataCellStyle);
+        configDataCellStyle.setWrapText(true);
+
+        return configDataCellStyle;
+    }
 
 }

--
Gitblit v1.9.3