fei
2026-01-07 4281f6c90e4a17845a5721ab51b3bc5c5409ab45
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);
                    // 如果是index为1的sheet,设置顶端标题行
@@ -401,7 +403,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 +527,7 @@
                row = sheet.createRow(i + 5 );
            else
                row = sheet.createRow(i + 1 );
            // 得到导出对象.
            T vo = (T) list.get(i);
            int column = 0;
@@ -551,17 +554,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 +603,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);
        // 总计行也设置自动换行
@@ -1094,7 +1097,7 @@
           // header.setFontSize((short) 10);
            // 设置页眉内容
            hssfSheet.setMargin(Sheet.HeaderMargin, 2.1);
            header.setRight("共 &N 页   第 &P页");
            header.setRight("&\"宋体,Bold\"共 &N 页   第 &P 页");
        }
        // 如果是index为1的sheet,设置顶端标题行
        if (index == 1) {