修复excel合并bug
This commit is contained in:
@@ -346,6 +346,7 @@ public class ExcelUtils{
|
|||||||
mergedCellStyle.alignment = HorizontalAlignment.CENTER;
|
mergedCellStyle.alignment = HorizontalAlignment.CENTER;
|
||||||
|
|
||||||
for (List<Integer> rowCell : data) {
|
for (List<Integer> rowCell : data) {
|
||||||
|
if (rowCell.get(0) != rowCell.get(1)) {
|
||||||
CellRangeAddress cra = new CellRangeAddress(rowCell.get(0), rowCell.get(1), rowCell.get(2), rowCell.get(3))
|
CellRangeAddress cra = new CellRangeAddress(rowCell.get(0), rowCell.get(1), rowCell.get(2), rowCell.get(3))
|
||||||
sheet.addMergedRegion(cra);
|
sheet.addMergedRegion(cra);
|
||||||
//设置合并后style
|
//设置合并后style
|
||||||
@@ -353,6 +354,7 @@ public class ExcelUtils{
|
|||||||
cell.setCellStyle(mergedCellStyle)
|
cell.setCellStyle(mergedCellStyle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static newWorkBook(String fileName){
|
public static newWorkBook(String fileName){
|
||||||
Workbook wb;
|
Workbook wb;
|
||||||
|
|||||||
Reference in New Issue
Block a user