From 2f1ae9c10a1751438d09b3d848677deb883631aa Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期三, 14 一月 2026 11:28:16 +0800
Subject: [PATCH] 修改了对应代码
---
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java | 48 ++++++++++++++++++++++++++++--------------------
1 files changed, 28 insertions(+), 20 deletions(-)
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 4631cea..822c066 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
@@ -316,8 +316,10 @@
printSetup.setLandscape(false); // 绾靛悜鎵撳嵃
// 璁剧疆椤佃竟璺�
- sheet.setMargin(Sheet.LeftMargin, 0.5);
- sheet.setMargin(Sheet.RightMargin, 0.5);
+ sheet.setMargin(Sheet.LeftMargin, 0.65);
+ sheet.setMargin(Sheet.RightMargin, 0.65);
+ sheet.setMargin(Sheet.TopMargin,0.31);
+ sheet.setMargin(Sheet.BottomMargin, 0.31);
// 璁剧疆鎵撳嵃鍖哄煙锛屼粠绗�0琛屽埌绗�1000琛岋紝绗�0鍒楀埌绗�20鍒楋紙鏍规嵁瀹為檯鎯呭喌璋冩暣锛�
// sheet.setPrintArea(0, 0, 20, 0, 1000);
// 濡傛灉鏄痠ndex涓�1鐨剆heet锛岃缃《绔爣棰樿
@@ -334,17 +336,22 @@
// if (Files.exists(Paths.get(imagePath))) {
// byte[] imageBytes = Files.readAllBytes(Paths.get(imagePath));
// 灏哹yte鏁扮粍杞崲鎴恑nputstream锛屼互渚挎彃鍏ュ埌Excel涓�
- ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 100, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 5),
- cell.getRow().getRowNum() + 1);
+ ClientAnchor anchor = new HSSFClientAnchor(813, 0, 787, 71, (short) 2, 0, (short) 4,
+ 1);
+
+
+
+// ClientAnchor anchor = new HSSFClientAnchor(813, 0, 787, 71, (short) 2, 0, (short) 4,
+// 2);
// 璁剧疆閿氱偣绫诲瀷涓篗OVE_AND_RESIZE锛屼娇鍥剧墖鍙互闅忓崟鍏冩牸璋冩暣澶у皬
anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
// 璁$畻灞呬腑浣嶇疆
- int col1 = 3; // 涓棿鍒�
- int col2 = col1 + 2;
- anchor.setCol1(col1);
- anchor.setCol2(col2);
- anchor.setRow1(0);
- anchor.setRow2(1);
+// int col1 = 3; // 涓棿鍒�
+// int col2 = col1 + 2;
+// anchor.setCol1(col1);
+// anchor.setCol2(col2);
+// anchor.setRow1(0);
+// anchor.setRow2(1);
// anchor.set
// anchor.setHorizontallyCenter(true);
@@ -401,7 +408,7 @@
CellStyle underlineStyle = wb.createCellStyle();
Font underlineFont = wb.createFont();
underlineFont.setFontName("瀹嬩綋");
- underlineFont.setFontHeightInPoints((short) 11);
+ underlineFont.setFontHeightInPoints((short) 12);
underlineFont.setUnderline(Font.U_SINGLE); // 璁剧疆涓嬪垝绾�
underlineStyle.setFont(underlineFont);
recordIdCell.setCellStyle(underlineStyle);
@@ -525,6 +532,7 @@
row = sheet.createRow(i + 5 );
else
row = sheet.createRow(i + 1 );
+
// 寰楀埌瀵煎嚭瀵硅薄.
T vo = (T) list.get(i);
int column = 0;
@@ -551,17 +559,17 @@
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setBorderRight(BorderStyle.THIN);
- style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+ style.setRightBorderColor(IndexedColors.BLACK.getIndex());
style.setBorderLeft(BorderStyle.THIN);
- style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+ style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
style.setBorderTop(BorderStyle.THIN);
- style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+ style.setTopBorderColor(IndexedColors.BLACK.getIndex());
style.setBorderBottom(BorderStyle.THIN);
- style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+ style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
// 璁剧疆鑷姩鎹㈣
style.setWrapText(true);
Font dataFont = wb.createFont();
- dataFont.setFontName("Arial");
+ dataFont.setFontName("瀹嬩綋");
dataFont.setFontHeightInPoints((short) 12);
style.setFont(dataFont);
styles.put("data", style);
@@ -600,7 +608,7 @@
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
Font totalFont = wb.createFont();
- totalFont.setFontName("Arial");
+ totalFont.setFontName("瀹嬩綋");
totalFont.setFontHeightInPoints((short) 12);
style.setFont(totalFont);
// 鎬昏琛屼篃璁剧疆鑷姩鎹㈣
@@ -1090,11 +1098,11 @@
HSSFSheet hssfSheet = hssfWb.getSheetAt(index);
HSSFHeader header = hssfSheet.getHeader();
// 璁剧疆椤电湁瀛椾綋
- // header.setFontName("瀹嬩綋");
+ // header.setFontName("瀹嬩綋");4
// header.setFontSize((short) 10);
// 璁剧疆椤电湁鍐呭
- hssfSheet.setMargin(Sheet.HeaderMargin, 2.1);
- header.setRight("鍏� &N 椤� 绗� &P椤�");
+ hssfSheet.setMargin(Sheet.HeaderMargin, 1.34);
+ header.setRight("&\"瀹嬩綋,Bold\"鍏� &N 椤� 绗� &P 椤�");
}
// 濡傛灉鏄痠ndex涓�1鐨剆heet锛岃缃《绔爣棰樿
if (index == 1) {
--
Gitblit v1.9.1