版本3.17
//设置合并单元格的边框
public static void setBorderForMergeCell(BorderStyle style,int color, CellRangeAddress cra,Sheet sheet){
RegionUtil.setBorderTop(style,cra,sheet);
RegionUtil.setBorderBottom(style,cra,sheet);
RegionUtil.setBorderLeft(style,cra,sheet);
RegionUtil.setBorderRight(style,cra,sheet);
RegionUtil.setTopBorderColor(color,cra,sheet);
RegionUtil.setBottomBorderColor(color,cra,sheet);
RegionUtil.setLeftBorderColor(color,cra,sheet);
RegionUtil.setRightBorderColor(color,cra,sheet);
}
调用
mergeCell(rowId, rowId + rowSkip,
colIndex, colIndex + cellSkip,sheet); // 起始行, 终止行, 起始列, 终止列 // 终止行,
setBorderForMergeCell(BorderStyle.MEDIUM,(short)22,new CellRangeAddress(rowId, rowId + rowSkip,
colIndex, colIndex + cellSkip),sheet);