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