update 优化 excel导出合并 在初始化类时进行数据的处理
This commit is contained in:
parent
f687bde93b
commit
b8e389bb7e
@ -28,20 +28,19 @@ import java.util.Map;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class CellMergeStrategy extends AbstractMergeStrategy {
|
public class CellMergeStrategy extends AbstractMergeStrategy {
|
||||||
|
|
||||||
private final List<?> list;
|
private final List<CellRangeAddress> cellList;
|
||||||
private final boolean hasTitle;
|
private final boolean hasTitle;
|
||||||
private int rowIndex;
|
private int rowIndex;
|
||||||
|
|
||||||
public CellMergeStrategy(List<?> list, boolean hasTitle) {
|
public CellMergeStrategy(List<?> list, boolean hasTitle) {
|
||||||
this.list = list;
|
|
||||||
this.hasTitle = hasTitle;
|
this.hasTitle = hasTitle;
|
||||||
// 行合并开始下标
|
// 行合并开始下标
|
||||||
this.rowIndex = hasTitle ? 1 : 0;
|
this.rowIndex = hasTitle ? 1 : 0;
|
||||||
|
this.cellList = handle(list, hasTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) {
|
protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) {
|
||||||
List<CellRangeAddress> cellList = handle(list, hasTitle);
|
|
||||||
// judge the list is not null
|
// judge the list is not null
|
||||||
if (CollUtil.isNotEmpty(cellList)) {
|
if (CollUtil.isNotEmpty(cellList)) {
|
||||||
// the judge is necessary
|
// the judge is necessary
|
||||||
|
Loading…
x
Reference in New Issue
Block a user