1

I am using POI to generate an Excel File. I need to add borders to all cells , i made a for loop i was able to add borders to all cells but not the last cells of the last row .

HSSFCellStyle cellStyleAllF = null;
cellStyleAllF = wb.createCellStyle();
cellStyleAllF.setAlignment(HSSFCellStyle.ALIGN_CENTER);
cellStyleAllF.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT);
cellStyleAllF.setBorderTop(HSSFCellStyle.BORDER_THIN);
cellStyleAllF.setTopBorderColor(HSSFColor.BLACK.index);
cellStyleAllF.setBorderRight(HSSFCellStyle.BORDER_THIN);
cellStyleAllF.setRightBorderColor(HSSFColor.BLACK.index);
cellStyleAllF.setBorderBottom(HSSFCellStyle.BORDER_THIN);
cellStyleAllF.setBottomBorderColor(HSSFColor.BLACK.index);
cellStyleAllF.setBorderLeft(HSSFCellStyle.BORDER_THIN);
cellStyleAllF.setLeftBorderColor(HSSFColor.BLACK.index);

enter image description here

deHaar
  • 17,687
  • 10
  • 38
  • 51

0 Answers0