疯狂的狮子li
2023-05-23 b8e389bb7e7e08ba64df847a46c27356bdef7d31
update 优化 excel导出合并 在初始化类时进行数据的处理
已修改1个文件
5 ■■■■■ 文件已修改
ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/CellMergeStrategy.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/core/CellMergeStrategy.java
@@ -28,20 +28,19 @@
@Slf4j
public class CellMergeStrategy extends AbstractMergeStrategy {
    private final List<?> list;
    private final List<CellRangeAddress> cellList;
    private final boolean hasTitle;
    private int rowIndex;
    public CellMergeStrategy(List<?> list, boolean hasTitle) {
        this.list = list;
        this.hasTitle = hasTitle;
        // 行合并开始下标
        this.rowIndex = hasTitle ? 1 : 0;
        this.cellList = handle(list, hasTitle);
    }
    @Override
    protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) {
        List<CellRangeAddress> cellList = handle(list, hasTitle);
        // judge the list is not null
        if (CollUtil.isNotEmpty(cellList)) {
            // the judge is necessary