Reputation: 187
I am trying to make a thick border for a cell
CellStyle topBorderStyle = workbook.createCellStyle();
topBorderStyle.setBorderTop(BorderStyle.THICK);
Row row1 = worksheet.createRow(0);
Cell cell1 = row1.createCell(0);
cell.setCellStyle(topBorderStyle);
As a result a cell does not have a thick border
Upvotes: 0
Views: 2961
Reputation: 9756
You are setting the style on cell
instead of cell1
.
Also I think you should be using HSSFCellStyle.BORDER_THICK
Try this:
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setBorderTop(HSSFCellStyle.BORDER_THICK);
Row row1 = worksheet.createRow(0);
Cell cell1 = row1.createCell(0);
cell1.setCellStyle(cellStyle);
I just tried it out and it works.
Upvotes: 1