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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.