|
|
@ -23,7 +23,7 @@ public class ExcelFillCellMergeStrategy implements CellWriteHandler { |
|
|
|
/** |
|
|
|
* 需要合并的列 下标 |
|
|
|
*/ |
|
|
|
private int[] mergeColumnIndex; |
|
|
|
private int[] mergeColumnIndexArr; |
|
|
|
/** |
|
|
|
* 从下标n行开始合并 |
|
|
|
*/ |
|
|
@ -32,9 +32,9 @@ public class ExcelFillCellMergeStrategy implements CellWriteHandler { |
|
|
|
public ExcelFillCellMergeStrategy() { |
|
|
|
} |
|
|
|
|
|
|
|
public ExcelFillCellMergeStrategy(int mergeRowIndex, int[] mergeColumnIndex) { |
|
|
|
public ExcelFillCellMergeStrategy(int mergeRowIndex, int[] mergeColumnIndexArr) { |
|
|
|
this.mergeRowIndex = mergeRowIndex; |
|
|
|
this.mergeColumnIndex = mergeColumnIndex; |
|
|
|
this.mergeColumnIndexArr = mergeColumnIndexArr; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -56,14 +56,13 @@ public class ExcelFillCellMergeStrategy implements CellWriteHandler { |
|
|
|
return; |
|
|
|
} |
|
|
|
//如果不指定 合并的列则全部列进行 合并判断
|
|
|
|
if (mergeColumnIndex == null) { |
|
|
|
if (mergeColumnIndexArr == null) { |
|
|
|
mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex); |
|
|
|
} else { |
|
|
|
//合并指定的列号
|
|
|
|
for (int columnIndex : mergeColumnIndex) { |
|
|
|
for (int columnIndex : mergeColumnIndexArr) { |
|
|
|
if (curColIndex == columnIndex) { |
|
|
|
mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|