From 5be5c89210dbb626dbb87a81265ff8eef92979df Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期一, 15 十二月 2025 15:32:57 +0800
Subject: [PATCH] 修改了对应代码
---
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java | 48 ++++++---
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 5
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java | 59 +++++++----
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java | 10 ++
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java | 48 ++++++---
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java | 15 +-
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java | 48 ++++++---
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java | 19 ++-
8 files changed, 165 insertions(+), 87 deletions(-)
diff --git a/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java b/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java
index d9f57ba..ef46602 100644
--- a/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java
+++ b/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java
@@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
+import org.apache.poi.ss.usermodel.IndexedColors;
import java.util.Date;
@@ -10,30 +11,30 @@
public class DocumentMaterialsVo {
- @Excel(name="搴忓彿", height = 10,width=10)
+ @Excel(name="搴忓彿", height = 10,width=8,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
private Long num;
- @Excel(name = "鏂囦欢缂栧彿", height = 10, width=15)
+ @Excel(name = "鏂囦欢缂栧彿", height = 10, width=8,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
private String documentNumber;
- @Excel(name = "璐d换鑰�", height = 10, width=10)
+ @Excel(name = "璐d换鑰�", height = 10, width=8,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
private String creator;
- @Excel(name = "鏂囦欢棰樺悕", height = 20)
+ @Excel(name = "鏂囦欢棰樺悕", height = 8,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
private String title;
@JsonFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "鏃ユ湡", width = 10, dateFormat = "yyyy-MM-dd", height = 10)
+ @Excel(name = "鏃ユ湡", width = 10, dateFormat = "yyyy-MM-dd", height = 10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
private Date date;
- @Excel(name = "椤靛彿", height = 10,width = 10)
+ @Excel(name = "椤靛彿", height = 10,width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
private Long pageNumber;
- @Excel(name = "澶囨敞", height = 20)
+ @Excel(name = "澶囨敞", height = 20,width=10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
private String remarks;
- @Excel(name = "妗e彿", height = 10)
+ @Excel(name = "妗e彿", height = 10,width=10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE, headerFontName = "Arial", headerFontBold = true)
private String recordId;
- @Excel(name = "鍏紑灞炴��", height = 10)
+ @Excel(name = "鍏紑灞炴��", height = 10,width=10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
private String publicity;
diff --git a/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java b/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java
index 970241c..7bb5bbc 100644
--- a/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java
+++ b/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java
@@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
+import org.apache.poi.ss.usermodel.IndexedColors;
import java.util.Date;
@@ -10,25 +11,25 @@
public class DocumentMaterialsVoSmall {
- @Excel(name="搴忓彿")
+ @Excel(name="搴忓彿",width = 5, headerColor = IndexedColors.BLACK, headerFontBold = true)
private Long num;
- @Excel(name = "鏂囦欢缂栧彿")
+ @Excel(name = "鏂囦欢缂栧彿",width = 10, headerColor = IndexedColors.BLACK, headerFontBold = true)
private String documentNumber;
- @Excel(name = "缂栦换鑰�")
+ @Excel(name = "璐d换鑰�",width = 10, headerColor = IndexedColors.BLACK, headerFontBold = true)
private String creator;
- @Excel(name = "鏂囦欢棰樺悕")
+ @Excel(name = "鏂囦欢棰樺悕",width = 36, headerColor = IndexedColors.BLACK, headerFontBold = true)
private String title;
@JsonFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
+ @Excel(name = "鏃ユ湡", width = 12, dateFormat = "yyyy-MM-dd", headerColor = IndexedColors.BLACK, headerFontBold = true)
private Date date;
- @Excel(name = "椤靛彿")
+ @Excel(name = "椤靛彿",width = 10, headerColor = IndexedColors.BLACK, headerFontBold = true)
private Long pageNumber;
- @Excel(name = "澶囨敞")
+ @Excel(name = "澶囨敞",width = 10, headerColor = IndexedColors.BLACK, headerFontBold = true)
private String remarks;
public DocumentMaterialsVoSmall(Long num, String documentNumber, String creator, String title, Date date, Long pageNumber, String remarks) {
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
index 7f951ad..6edd6f5 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
@@ -134,6 +134,16 @@
public IndexedColors headerColor() default IndexedColors.WHITE;
/**
+ * 瀵煎嚭鍒楀ご瀛椾綋鍚嶇О
+ */
+ public String headerFontName() default "Arial";
+
+ /**
+ * 瀵煎嚭鍒楀ご瀛椾綋鏄惁鍔犵矖
+ */
+ public boolean headerFontBold() default false;
+
+ /**
* 瀵煎嚭鍗曞厓鏍艰儗鏅鑹�
*/
public IndexedColors backgroundColor() default IndexedColors.WHITE;
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 3abe6b0..9880129 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
@@ -910,8 +910,9 @@
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
- style.setFillForegroundColor(excel.headerBackgroundColor().index);
- style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+ // 宸叉敞閲婏紝琛ㄥご涓嶆樉绀鸿儗鏅壊
+ // style.setFillForegroundColor(excel.headerBackgroundColor().index);
+ // style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 璁剧疆琛ㄥご鑷姩鎹㈣
style.setWrapText(true);
Font headerFont = wb.createFont();
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java
index 62fdb18..105f862 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java
@@ -295,7 +295,7 @@
// 鍒涘缓琛屽苟璁剧疆楂樺害
row = sheet.createRow(0);
- row.setHeight((short)(40 * 40));
+ row.setHeight((short)(30 *30));
// 鍒涘缓鍗曞厓鏍煎苟娣诲姞鍥剧墖
Cell cell = row.createCell(0);
@@ -307,8 +307,8 @@
ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 5),
cell.getRow().getRowNum() + 1);
// 璁$畻灞呬腑浣嶇疆
- int col1 = 1; // 涓棿鍒�
- int col2 = col1 + 5;
+ int col1 = 3; // 涓棿鍒�
+ int col2 = col1 + 2;
anchor.setCol1(col1);
anchor.setCol2(col2);
anchor.setRow1(0);
@@ -335,12 +335,13 @@
row = sheet.createRow(1);
sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 6));
Cell titleCell = row.createCell(0);
- titleCell.setCellValue("鍗峰唴鐩綍");
- // 璁剧疆鍔犵矖鍜屽眳涓牱寮�
+ titleCell.setCellValue("鍗� 鍐� 鐩� 褰�");
+ // 璁剧疆鍔犵矖銆佸畫浣撱��18鍙峰瓧浣撳拰灞呬腑鏍峰紡
CellStyle style = wb.createCellStyle();
Font font = wb.createFont();
font.setBold(true);
font.setFontName("瀹嬩綋");
+ font.setFontHeightInPoints((short) 18);
style.setFont(font);
style.setAlignment(HorizontalAlignment.CENTER);
titleCell.setCellStyle(style);
@@ -508,21 +509,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.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);
- // 琛ㄥご涔熻缃嚜鍔ㄦ崲琛�
- style.setWrapText(true);
- 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(), excel.headerFontName(), excel.headerFontBold());
+ if (!headerStyles.containsKey(key))
+ {
+ style = wb.createCellStyle();
+ style.cloneStyleFrom(styles.get("data"));
+ style.setAlignment(HorizontalAlignment.CENTER);
+ style.setVerticalAlignment(VerticalAlignment.CENTER);
+ // 鏍规嵁娉ㄨВ璁剧疆琛ㄥご鑳屾櫙鑹� - 宸叉敞閲婏紝琛ㄥご涓嶆樉绀鸿儗鏅壊
+ /*if (excel.headerBackgroundColor() != IndexedColors.WHITE) {
+ style.setFillForegroundColor(excel.headerBackgroundColor().index);
+ style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+ }*/
+ // 璁剧疆琛ㄥご鑷姩鎹㈣
+ style.setWrapText(true);
+ Font headerFont = wb.createFont();
+ headerFont.setFontName(excel.headerFontName());
+ headerFont.setFontHeightInPoints((short) 10);
+ headerFont.setBold(excel.headerFontBold());
+ headerFont.setColor(excel.headerColor().index);
+ style.setFont(headerFont);
+ headerStyles.put(key, style);
+ }
+ }
+ styles.putAll(headerStyles);
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
@@ -568,7 +583,9 @@
// 鍐欏叆鍒椾俊鎭�
cell.setCellValue(attr.name());
setDataValidation(attr, row, column);
- cell.setCellStyle(styles.get("header"));
+ // 鏍规嵁Excel娉ㄨВ鍔ㄦ�侀�夋嫨琛ㄥご鏍峰紡
+ String key = StringUtils.format("header_{}_{}_{}_{}", attr.headerColor(), attr.headerBackgroundColor(), attr.headerFontName(), attr.headerFontBold());
+ cell.setCellStyle(styles.get(key));
return cell;
}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java
index 90f7cc9..4daa4a4 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java
@@ -554,21 +554,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);
@@ -614,7 +628,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;
}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java
index a2bcb03..53de95f 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java
@@ -604,21 +604,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(excel.headerFontBold());
+ headerFont.setColor(excel.headerColor().index);
+ style.setFont(headerFont);
+ headerStyles.put(key, style);
+ }
+ }
+ styles.putAll(headerStyles);
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
@@ -664,7 +678,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;
}
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..ae5014f 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
@@ -469,21 +469,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 +543,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