fei
2025-12-14 29d3490e983cadd2b2107486214488e382a72fcc
修改了对应代码
10个文件已修改
330 ■■■■■ 已修改文件
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoLarge.java 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java
@@ -10,30 +10,30 @@
public class DocumentMaterialsVo {
    @Excel(name="序号")
    @Excel(name="序号", height = 10,width=10)
    private Long num;
    @Excel(name = "文件编号")
    @Excel(name = "文件编号", height = 10, width=15)
    private String documentNumber;
    @Excel(name = "编任者")
    @Excel(name = "责任者", height = 10, width=10)
    private String creator;
    @Excel(name = "文件题名")
    @Excel(name = "文件题名", height = 20)
    private String title;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
    @Excel(name = "日期", width = 10, dateFormat = "yyyy-MM-dd", height = 10)
    private Date date;
    @Excel(name = "页号")
    @Excel(name = "页号", height = 10,width = 10)
    private Long pageNumber;
    @Excel(name = "备注")
    @Excel(name = "备注", height = 20)
    private String remarks;
    @Excel(name = "档号")
    @Excel(name = "档号", height = 10)
    private String recordId;
    @Excel(name = "公开属性")
    @Excel(name = "公开属性", height = 10)
    private String publicity;
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoLarge.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.NumberFormatHandler;
import lombok.Data;
import org.apache.poi.ss.usermodel.IndexedColors;
import java.util.Date;
@@ -217,49 +218,49 @@
        this.title = title;
    }
    @Excel(name="序号")
    @Excel(name="序号", headerColor = IndexedColors.RED,width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private int num;
    @Excel(name="档号")
    @Excel(name="档号",headerColor = IndexedColors.RED,width = 15, headerBackgroundColor = IndexedColors.WHITE)
    private String recordId;
    @Excel(name = "文件材料序号", handler = NumberFormatHandler.class)
    @Excel(name = "文件材料序号", width=10,headerColor = IndexedColors.RED,handler = NumberFormatHandler.class, headerBackgroundColor = IndexedColors.WHITE)
    private Long fileNumber;
    @Excel(name = "文件编号")
    @Excel(name = "文件编号",width=9,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String documentNumber;
    /** $column.columnComment */
    @Excel(name = "编任者")
    @Excel(name = "责任者",width=8,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String creator;
    /** $column.columnComment */
    @Excel(name = "文件题名")
    @Excel(name = "文件题名",headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private String title;
    /** $column.columnComment */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
    @Excel(name = "日期", width = 10, headerColor = IndexedColors.BLACK,dateFormat = "yyyy-MM-dd", headerBackgroundColor = IndexedColors.WHITE)
    private Date date;
    /** $column.columnComment */
    @Excel(name = "页号", handler = NumberFormatHandler.class)
    @Excel(name = "页号",  width = 10,headerColor = IndexedColors.RED,handler = NumberFormatHandler.class, headerBackgroundColor = IndexedColors.WHITE)
    private Long pageNumber;
    /** $column.columnComment */
    @Excel(name = "页次")
    @Excel(name = "页次", width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private Long pageOrder;
    /** $column.columnComment */
    @Excel(name = "所处阶段")
    @Excel(name = "所处阶段", width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private String stage;
    /** $column.columnComment */
    @Excel(name = "公开属性")
    @Excel(name = "公开属性", width = 10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String publicity;
    /** $column.columnComment */
    @Excel(name = "是否为附件附图")
    @Excel(name = "是否为附件附图", width = 10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String isAttachment;
    /** $column.columnComment */
@@ -267,55 +268,55 @@
    private String isDiagram;
    /** $column.columnComment */
    @Excel(name = "保管期限")
    @Excel(name = "保管期限", width = 10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String retentionPeriod;
    /** $column.columnComment */
    @Excel(name = "密级", readConverterExp = "该页另存=普通,普通=普通,内部用图=内部用图,内部用途=内部用途,秘密=秘密")
    @Excel(name = "密级", width = 10,headerColor = IndexedColors.BLACK,readConverterExp = "该页另存=普通,普通=普通,内部用图=内部用图,内部用途=内部用途,秘密=秘密", headerBackgroundColor = IndexedColors.WHITE)
    private String securityLevel;
    /** $column.columnComment */
    @Excel(name = "是否涉密及敏感信息")
    @Excel(name = "是否涉密及敏感信息",headerColor = IndexedColors.BLACK, width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private String isSensitive;
    /** $column.columnComment */
    @Excel(name = "是否注销")
    @Excel(name = "是否注销" ,headerColor = IndexedColors.BLACK,width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private String isCanceled;
    /** $column.columnComment */
    @Excel(name = "格式")
    @Excel(name = "格式",headerColor = IndexedColors.RED,width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private String format;
    /** $column.columnComment */
    @Excel(name = "幅面")
    @Excel(name = "幅面", headerColor = IndexedColors.RED,width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private String sizeType;
    /** $column.columnComment */
    @Excel(name = "水平分辨率")
    @Excel(name = "水平分辨率",headerColor = IndexedColors.RED, width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private Long horizontalResolution;
    /** $column.columnComment */
    @Excel(name = "垂直分辨率")
    @Excel(name = "垂直分辨率",headerColor = IndexedColors.RED, width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private Long verticalResolution;
    /** $column.columnComment */
    @Excel(name = "宽度")
    @Excel(name = "宽度", headerColor = IndexedColors.RED,width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private Long width;
    /** $column.columnComment */
    @Excel(name = "高度")
    @Excel(name = "高度", headerColor = IndexedColors.RED,width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private Long height;
    /** $column.columnComment */
    @Excel(name = "大小")
    @Excel(name = "大小", headerColor = IndexedColors.RED,width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private Double fileSize;
    /** $column.columnComment */
    @Excel(name = "附件及历史发文号")
    @Excel(name = "附件及历史发文号",headerColor = IndexedColors.BLACK, width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private String attachmentHistoryNumbers;
    /** $column.columnComment */
    @Excel(name = "备注")
    //@Excel(name = "备注", width = 10)
    private String remarks;
    public String getUrl() {
        return url;
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
@@ -235,6 +235,7 @@
            for(int i = 0; i < ids.length; i++) {
                // 获取文件的保存位置,读取数据库,
                DocumentMaterials documentMaterials = new DocumentMaterials();
                documentMaterials.setRecordId(ids[i]);
@@ -247,7 +248,7 @@
                ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(ids[i]);
                String adir = aIV.getInquiryNumber() + " " + aIV.getRecordId();
                System.out.println(fna + adir);
                System.out.println(fna+adir);
                zos.putNextEntry(new ZipEntry(fna + adir + "/"));
                //在里面添加文件
@@ -531,6 +532,8 @@
        System.out.println(filePath+"0009999999999");
        response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
        FileUtils.setAttachmentResponseHeader(response, realFileName);
     //   response.addHeader("Content-Disposition", "attachment;filename=fileName" + ".xls");
        FileUtils.writeBytes(filePath, response.getOutputStream());
    }
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
@@ -86,7 +86,7 @@
    /**
     * 是否允许内容换行 
     */
    public boolean wrapText() default false;
    public boolean wrapText() default true;
    /**
     * 设置只能选择不能输入的列内容.
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
@@ -221,6 +221,12 @@
                .append("utf-8''")
                .append(percentEncodedFileName);
        response.setCharacterEncoding("UTF-8");
        response.setHeader("content-Type", "application/vnd.ms-excel");
        response.setHeader("Content-Disposition",
                "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8"));
//        response.addHeader("Content-Disposition", "attachment;filename=fileName" + ".xls");
        response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename");
        response.setHeader("Content-disposition", contentDispositionValue.toString());
        response.setHeader("download-filename", percentEncodedFileName);
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
@@ -912,10 +912,12 @@
                style.setVerticalAlignment(VerticalAlignment.CENTER);
                style.setFillForegroundColor(excel.headerBackgroundColor().index);
                style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
                // 设置表头自动换行
                style.setWrapText(true);
                Font headerFont = wb.createFont();
                headerFont.setFontName("Arial");
                headerFont.setFontHeightInPoints((short) 10);
                headerFont.setBold(true);
                headerFont.setBold(false);
                headerFont.setColor(excel.headerColor().index);
                style.setFont(headerFont);
                // 设置表格头单元格文本形式
@@ -1054,7 +1056,7 @@
        }
        else if (ColumnType.IMAGE == attr.cellType())
        {
            ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1), cell.getRow().getRowNum() + 1);
            ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1), cell.getRow().getRowNum() + 1);
            String propertyValue = Convert.toStr(value);
            if (StringUtils.isNotEmpty(propertyValue))
            {
@@ -1145,8 +1147,8 @@
        Cell cell = null;
        try
        {
            // 设置行高
            row.setHeight(maxHeight);
            // 设置行高为自动调整
            row.setHeight((short) -1);
            // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
            if (attr.isExport())
            {
@@ -1658,7 +1660,7 @@
     */
    public void createWorkbook()
    {
        this.wb = new SXSSFWorkbook(500);
        this.wb = new HSSFWorkbook();
        this.sheet = wb.createSheet();
        wb.setSheetName(0, sheetName);
        this.styles = createStyles(wb);
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java
@@ -17,9 +17,12 @@
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -301,7 +304,7 @@
                      //  if (Files.exists(Paths.get(imagePath))) {
                          //  byte[] imageBytes = Files.readAllBytes(Paths.get(imagePath));
                            // 将byte数组转换成inputstream,以便插入到Excel中
                            ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 5),
                            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; // 中间列
@@ -497,6 +500,8 @@
        style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderBottom(BorderStyle.THIN);
        style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        // 设置自动换行
        style.setWrapText(true);
        Font dataFont = wb.createFont();
        dataFont.setFontName("Arial");
        dataFont.setFontHeightInPoints((short) 10);
@@ -515,6 +520,8 @@
        headerFont.setBold(true);
        headerFont.setColor(IndexedColors.WHITE.getIndex());
        style.setFont(headerFont);
        // 表头也设置自动换行
        style.setWrapText(true);
        styles.put("header", style);
        style = wb.createCellStyle();
@@ -524,21 +531,29 @@
        totalFont.setFontName("Arial");
        totalFont.setFontHeightInPoints((short) 10);
        style.setFont(totalFont);
        // 总计行也设置自动换行
        style.setWrapText(true);
        styles.put("total", style);
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.LEFT);
        // 左对齐样式也设置自动换行
        style.setWrapText(true);
        styles.put("data1", style);
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.CENTER);
        // 居中对齐样式也设置自动换行
        style.setWrapText(true);
        styles.put("data2", style);
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.RIGHT);
        // 右对齐样式也设置自动换行
        style.setWrapText(true);
        styles.put("data3", style);
        return styles;
@@ -570,7 +585,7 @@
        } else if (Excel.ColumnType.NUMERIC == attr.cellType()) {
            cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
        } else if (Excel.ColumnType.IMAGE == attr.cellType()) {
            ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1),
            ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1),
                    cell.getRow().getRowNum() + 1);
            String imagePath = Convert.toStr(value);
            if (StringUtils.isNotEmpty(imagePath)) {
@@ -617,12 +632,12 @@
        // 如果设置了提示信息则鼠标放上去提示.
        if (StringUtils.isNotEmpty(attr.prompt())) {
            // 这里默认设了2-101列提示.
            setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
            setHSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
        }
        // 如果设置了combo属性则本列只能选择不能输入
        if (attr.combo().length > 0) {
            // 这里默认设了2-101列只能选择不能输入.
            setXSSFValidation(sheet, attr.combo(), 1, 100, column, column);
            setHSSFValidation(sheet, attr.combo(), 1, 100, column, column);
        }
    }
@@ -632,15 +647,23 @@
    public Cell addCell(Excel attr, Row row, T vo, Field field, int column) {
        Cell cell = null;
        try {
            // 设置行高
            row.setHeight(maxHeight);
            // 设置行高为自动调整
            row.setHeight((short) -1);
            // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
            if (attr.isExport()) {
                // 创建cell
                cell = row.createCell(column);
//                attr.align();
//                int align = attr.align().value;
//                cell.setCellStyle(styles.get("data" + (align >= 1 && align <= 3 ? align : "")));
                // 设置单元格样式
                HorizontalAlignment align = attr.align();
                String styleKey = "data";
                if (align == HorizontalAlignment.LEFT) {
                    styleKey = "data1";
                } else if (align == HorizontalAlignment.CENTER) {
                    styleKey = "data2";
                } else if (align == HorizontalAlignment.RIGHT) {
                    styleKey = "data3";
                }
                cell.setCellStyle(styles.get(styleKey));
                // 用于读取对象中的属性
                Object value = getTargetValue(vo, field, attr);
@@ -666,7 +689,7 @@
    }
    /**
     * 设置 POI XSSFSheet 单元格提示
     * 设置 POI HSSFSheet 单元格提示
     *
     * @param sheet         表单
     * @param promptTitle   提示标题
@@ -676,7 +699,7 @@
     * @param firstCol      开始列
     * @param endCol        结束列
     */
    public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
    public void setHSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
                              int firstCol, int endCol) {
        DataValidationHelper helper = sheet.getDataValidationHelper();
        DataValidationConstraint constraint = helper.createCustomConstraint("DD1");
@@ -698,7 +721,7 @@
     * @param endCol   结束列
     * @return 设置好的sheet.
     */
    public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
    public void setHSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
        DataValidationHelper helper = sheet.getDataValidationHelper();
        // 加载下拉列表内容
        DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist);
@@ -707,11 +730,9 @@
        // 数据有效性对象
        DataValidation dataValidation = helper.createValidation(constraint, regions);
        // 处理Excel兼容性问题
        if (dataValidation instanceof XSSFDataValidation) {
            dataValidation.setSuppressDropDownArrow(true);
            dataValidation.setShowErrorBox(true);
        } else {
        if (dataValidation instanceof HSSFDataValidation) {
            dataValidation.setSuppressDropDownArrow(false);
            dataValidation.setShowErrorBox(true);
        }
        sheet.addValidationData(dataValidation);
@@ -908,7 +929,7 @@
     * 创建一个工作簿
     */
    public void createWorkbook() {
        this.wb = new SXSSFWorkbook(500);
        this.wb = new HSSFWorkbook();
    }
    /**
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java
@@ -15,9 +15,14 @@
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -302,7 +307,7 @@
                        Cell cell = row.createCell(6);
                        // 设置图片大小和位置
                        ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) (cell.getColumnIndex()+1), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() +2),
                        ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) (cell.getColumnIndex()+1), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() +2),
                                cell.getRow().getRowNum() + 1);
                        // 计算居中位置
//                    int col1 = 0; // 中间列
@@ -533,6 +538,8 @@
        CellStyle style = wb.createCellStyle();
        style.setAlignment(HorizontalAlignment.CENTER);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        style.setBorderRight(BorderStyle.THIN);
        style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderLeft(BorderStyle.THIN);
@@ -551,6 +558,8 @@
        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();
@@ -564,6 +573,8 @@
        style = wb.createCellStyle();
        style.setAlignment(HorizontalAlignment.CENTER);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        Font totalFont = wb.createFont();
        totalFont.setFontName("Arial");
        totalFont.setFontHeightInPoints((short) 10);
@@ -573,16 +584,22 @@
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.LEFT);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        styles.put("data1", style);
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        styles.put("data2", style);
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.RIGHT);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        styles.put("data3", style);
        return styles;
@@ -614,7 +631,7 @@
        } else if (Excel.ColumnType.NUMERIC == attr.cellType()) {
            cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
        } else if (Excel.ColumnType.IMAGE == attr.cellType()) {
            ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1),
            ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1),
                    cell.getRow().getRowNum() + 1);
            String imagePath = Convert.toStr(value);
            if (StringUtils.isNotEmpty(imagePath)) {
@@ -661,12 +678,12 @@
        // 如果设置了提示信息则鼠标放上去提示.
        if (StringUtils.isNotEmpty(attr.prompt())) {
            // 这里默认设了2-101列提示.
            setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
            setHSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
        }
        // 如果设置了combo属性则本列只能选择不能输入
        if (attr.combo().length > 0) {
            // 这里默认设了2-101列只能选择不能输入.
            setXSSFValidation(sheet, attr.combo(), 1, 100, column, column);
            setHSSFValidation(sheet, attr.combo(), 1, 100, column, column);
        }
    }
@@ -676,15 +693,23 @@
    public Cell addCell(Excel attr, Row row, T vo, Field field, int column) {
        Cell cell = null;
        try {
            // 设置行高
            row.setHeight(maxHeight);
            // 设置行高为自动调整
            row.setHeight((short) -1);
            // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
            if (attr.isExport()) {
                // 创建cell
                cell = row.createCell(column);
//                attr.align();
//                int align = attr.align().value;
//                cell.setCellStyle(styles.get("data" + (align >= 1 && align <= 3 ? align : "")));
                // 设置单元格样式
                HorizontalAlignment align = attr.align();
                String styleKey = "data";
                if (align == HorizontalAlignment.LEFT) {
                    styleKey = "data1";
                } else if (align == HorizontalAlignment.CENTER) {
                    styleKey = "data2";
                } else if (align == HorizontalAlignment.RIGHT) {
                    styleKey = "data3";
                }
                cell.setCellStyle(styles.get(styleKey));
                // 用于读取对象中的属性
                Object value = getTargetValue(vo, field, attr);
@@ -710,7 +735,7 @@
    }
    /**
     * 设置 POI XSSFSheet 单元格提示
     * 设置 POI HSSFSheet 单元格提示
     *
     * @param sheet         表单
     * @param promptTitle   提示标题
@@ -720,7 +745,7 @@
     * @param firstCol      开始列
     * @param endCol        结束列
     */
    public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
    public void setHSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
                              int firstCol, int endCol) {
        DataValidationHelper helper = sheet.getDataValidationHelper();
        DataValidationConstraint constraint = helper.createCustomConstraint("DD1");
@@ -742,7 +767,7 @@
     * @param endCol   结束列
     * @return 设置好的sheet.
     */
    public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
    public void setHSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
        DataValidationHelper helper = sheet.getDataValidationHelper();
        // 加载下拉列表内容
        DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist);
@@ -751,11 +776,9 @@
        // 数据有效性对象
        DataValidation dataValidation = helper.createValidation(constraint, regions);
        // 处理Excel兼容性问题
        if (dataValidation instanceof XSSFDataValidation) {
            dataValidation.setSuppressDropDownArrow(true);
            dataValidation.setShowErrorBox(true);
        } else {
        if (dataValidation instanceof HSSFDataValidation) {
            dataValidation.setSuppressDropDownArrow(false);
            dataValidation.setShowErrorBox(true);
        }
        sheet.addValidationData(dataValidation);
@@ -952,7 +975,7 @@
     * 创建一个工作簿
     */
    public void createWorkbook() {
        this.wb = new SXSSFWorkbook(500);
        this.wb = new HSSFWorkbook();
    }
    /**
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java
@@ -16,9 +16,12 @@
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -299,7 +302,7 @@
//sheet.setColumnWidth(1, 15 * 256); // 第二列宽度15字符
//sheet.setColumnWidth(2, 25 * 256); // 第三列宽度25字符 // 设置第一列宽度为20个字符
                    ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) (cell.getColumnIndex()+1), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() +2),
                    ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) (cell.getColumnIndex()+1), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() +2),
                            cell.getRow().getRowNum() + 1);
                    // 计算居中位置
//                    int col1 = 0; // 中间列
@@ -379,7 +382,7 @@
                        Font font = wb.createFont();
                        font.setBold(true);
                        style.setFont(font);
style.setWrapText(true); // 设置自动换行
                        style.setWrapText(true); // 设置自动换行
                        cell.setCellStyle(style);
                        cell.setCellValue(tits[i]);
                        Cell cel = row.createCell(1);
@@ -394,6 +397,8 @@
                        if(i==3)
                        {
                            row = sheet.createRow(8);
                            // 设置行高为自动调整
                            row.setHeight((short) -1);
                            // row.setHeight((short) 30);
                            row.setHeightInPoints(40); // 设置行高为20磅
                            row = sheet.createRow(9);
@@ -403,7 +408,7 @@
//sheet.setColumnWidth(1, 15 * 256); // 第二列宽度15字符
//sheet.setColumnWidth(2, 25 * 256); // 第三列宽度25字符 // 设置第一列宽度为20个字符
                            ClientAnchor anchor1 = new XSSFClientAnchor(0, 0, 0, 0, (short) (cell1.getColumnIndex()), cell1.getRow().getRowNum(), (short) (cell1.getColumnIndex() +2),
                            ClientAnchor anchor1 = new HSSFClientAnchor(0, 0, 0, 0, (short) (cell1.getColumnIndex()), cell1.getRow().getRowNum(), (short) (cell1.getColumnIndex() +2),
                                    cell1.getRow().getRowNum() + 1);
                            // 计算居中位置
//// 设置图片大小和位置
@@ -583,6 +588,8 @@
        CellStyle style = wb.createCellStyle();
        style.setAlignment(HorizontalAlignment.CENTER);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        style.setBorderRight(BorderStyle.THIN);
        style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderLeft(BorderStyle.THIN);
@@ -601,6 +608,8 @@
        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();
@@ -614,6 +623,8 @@
        style = wb.createCellStyle();
        style.setAlignment(HorizontalAlignment.CENTER);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        Font totalFont = wb.createFont();
        totalFont.setFontName("Arial");
        totalFont.setFontHeightInPoints((short) 10);
@@ -623,16 +634,22 @@
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.LEFT);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        styles.put("data1", style);
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        styles.put("data2", style);
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.RIGHT);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        styles.put("data3", style);
        return styles;
@@ -664,7 +681,7 @@
        } else if (Excel.ColumnType.NUMERIC == attr.cellType()) {
            cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
        } else if (Excel.ColumnType.IMAGE == attr.cellType()) {
            ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1),
            ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1),
                    cell.getRow().getRowNum() + 1);
            String imagePath = Convert.toStr(value);
            if (StringUtils.isNotEmpty(imagePath)) {
@@ -711,12 +728,12 @@
        // 如果设置了提示信息则鼠标放上去提示.
        if (StringUtils.isNotEmpty(attr.prompt())) {
            // 这里默认设了2-101列提示.
            setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
            setHSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
        }
        // 如果设置了combo属性则本列只能选择不能输入
        if (attr.combo().length > 0) {
            // 这里默认设了2-101列只能选择不能输入.
            setXSSFValidation(sheet, attr.combo(), 1, 100, column, column);
            setHSSFValidation(sheet, attr.combo(), 1, 100, column, column);
        }
    }
@@ -726,8 +743,8 @@
    public Cell addCell(Excel attr, Row row, T vo, Field field, int column) {
        Cell cell = null;
        try {
            // 设置行高
            row.setHeight((short) 2000);
            // 设置行高为自动调整
            row.setHeight((short) -1);
            // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
            if (attr.isExport()) {
                // 创建cell
@@ -775,7 +792,7 @@
    }
    /**
     * 设置 POI XSSFSheet 单元格提示
     * 设置 POI HSSFSheet 单元格提示
     *
     * @param sheet         表单
     * @param promptTitle   提示标题
@@ -785,7 +802,7 @@
     * @param firstCol      开始列
     * @param endCol        结束列
     */
    public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
    public void setHSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
                              int firstCol, int endCol) {
        DataValidationHelper helper = sheet.getDataValidationHelper();
        DataValidationConstraint constraint = helper.createCustomConstraint("DD1");
@@ -807,7 +824,7 @@
     * @param endCol   结束列
     * @return 设置好的sheet.
     */
    public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
    public void setHSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
        DataValidationHelper helper = sheet.getDataValidationHelper();
        // 加载下拉列表内容
        DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist);
@@ -816,11 +833,9 @@
        // 数据有效性对象
        DataValidation dataValidation = helper.createValidation(constraint, regions);
        // 处理Excel兼容性问题
        if (dataValidation instanceof XSSFDataValidation) {
            dataValidation.setSuppressDropDownArrow(true);
            dataValidation.setShowErrorBox(true);
        } else {
        if (dataValidation instanceof HSSFDataValidation) {
            dataValidation.setSuppressDropDownArrow(false);
            dataValidation.setShowErrorBox(true);
        }
        sheet.addValidationData(dataValidation);
@@ -1017,7 +1032,7 @@
     * 创建一个工作簿
     */
    public void createWorkbook() {
        this.wb = new SXSSFWorkbook(500);
        this.wb = new HSSFWorkbook();
    }
    /**
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java
@@ -16,9 +16,12 @@
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -450,6 +453,8 @@
        CellStyle style = wb.createCellStyle();
        style.setAlignment(HorizontalAlignment.CENTER);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        style.setBorderRight(BorderStyle.THIN);
        style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderLeft(BorderStyle.THIN);
@@ -468,6 +473,8 @@
        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();
@@ -481,6 +488,8 @@
        style = wb.createCellStyle();
        style.setAlignment(HorizontalAlignment.CENTER);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        Font totalFont = wb.createFont();
        totalFont.setFontName("Arial");
        totalFont.setFontHeightInPoints((short) 10);
@@ -490,16 +499,22 @@
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.LEFT);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        styles.put("data1", style);
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        styles.put("data2", style);
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.RIGHT);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        styles.put("data3", style);
        return styles;
@@ -531,7 +546,7 @@
        } else if (Excel.ColumnType.NUMERIC == attr.cellType()) {
            cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
        } else if (Excel.ColumnType.IMAGE == attr.cellType()) {
            ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1),
            ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1),
                    cell.getRow().getRowNum() + 1);
            String imagePath = Convert.toStr(value);
            if (StringUtils.isNotEmpty(imagePath)) {
@@ -578,12 +593,12 @@
        // 如果设置了提示信息则鼠标放上去提示.
        if (StringUtils.isNotEmpty(attr.prompt())) {
            // 这里默认设了2-101列提示.
            setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
            setHSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
        }
        // 如果设置了combo属性则本列只能选择不能输入
        if (attr.combo().length > 0) {
            // 这里默认设了2-101列只能选择不能输入.
            setXSSFValidation(sheet, attr.combo(), 1, 100, column, column);
            setHSSFValidation(sheet, attr.combo(), 1, 100, column, column);
        }
    }
@@ -593,15 +608,23 @@
    public Cell addCell(Excel attr, Row row, T vo, Field field, int column) {
        Cell cell = null;
        try {
            // 设置行高
            row.setHeight(maxHeight);
            // 设置行高为自动调整
            row.setHeight((short) -1);
            // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
            if (attr.isExport()) {
                // 创建cell
                cell = row.createCell(column);
//                attr.align();
//                int align = attr.align().value;
//                cell.setCellStyle(styles.get("data" + (align >= 1 && align <= 3 ? align : "")));
                // 设置单元格样式
                HorizontalAlignment align = attr.align();
                String styleKey = "data";
                if (align == HorizontalAlignment.LEFT) {
                    styleKey = "data1";
                } else if (align == HorizontalAlignment.CENTER) {
                    styleKey = "data2";
                } else if (align == HorizontalAlignment.RIGHT) {
                    styleKey = "data3";
                }
                cell.setCellStyle(styles.get(styleKey));
                // 用于读取对象中的属性
                Object value = getTargetValue(vo, field, attr);
@@ -627,7 +650,7 @@
    }
    /**
     * 设置 POI XSSFSheet 单元格提示
     * 设置 POI HSSFSheet 单元格提示
     *
     * @param sheet         表单
     * @param promptTitle   提示标题
@@ -637,7 +660,7 @@
     * @param firstCol      开始列
     * @param endCol        结束列
     */
    public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
    public void setHSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
                              int firstCol, int endCol) {
        DataValidationHelper helper = sheet.getDataValidationHelper();
        DataValidationConstraint constraint = helper.createCustomConstraint("DD1");
@@ -659,7 +682,7 @@
     * @param endCol   结束列
     * @return 设置好的sheet.
     */
    public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
    public void setHSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
        DataValidationHelper helper = sheet.getDataValidationHelper();
        // 加载下拉列表内容
        DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist);
@@ -668,11 +691,9 @@
        // 数据有效性对象
        DataValidation dataValidation = helper.createValidation(constraint, regions);
        // 处理Excel兼容性问题
        if (dataValidation instanceof XSSFDataValidation) {
            dataValidation.setSuppressDropDownArrow(true);
            dataValidation.setShowErrorBox(true);
        } else {
        if (dataValidation instanceof HSSFDataValidation) {
            dataValidation.setSuppressDropDownArrow(false);
            dataValidation.setShowErrorBox(true);
        }
        sheet.addValidationData(dataValidation);
@@ -869,7 +890,7 @@
     * 创建一个工作簿
     */
    public void createWorkbook() {
        this.wb = new SXSSFWorkbook(500);
        this.wb = new HSSFWorkbook();
    }
    /**