/** * 合并单元格后给合并后的单元格加边框 * * @param region * @param cs */ public void setRegionStyle(CellRangeAddress region, XSSFCellStyle cs) { int toprowNum = region.getFirstRow(); for (int i = toprowNum; i <= region.getLastRow(); i++) { XSSFRow row = sheet.getRow(i); for (int j = region.getFirstColumn(); j <= region.getLastColumn(); j++) { XSSFCell cell = row.getCell(j); // XSSFCellUtil.getCell(row, // (short) j); cell.setCellStyle(cs); } } }