Bug 54354 - Right Side Border not rendered.
Summary: Right Side Border not rendered.
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.9-FINAL
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-27 21:14 UTC by Gustavo
Modified: 2015-08-11 22:15 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo 2012-12-27 21:14:46 UTC
Setting the borders, the border of the right side is not being rendered.

I develop a pice of code for easy test:

public Workbook createWorkBook() {
	    Workbook wb = new HSSFWorkbook();
	    Sheet sheet = wb.createSheet("new sheet");

	    Row row = sheet.createRow((short) 1);
	    Cell cell = row.createCell((short) 1);
	    cell.setCellValue("This is a test of merging");

	    sheet.addMergedRegion(new CellRangeAddress(
	            1, //first row (0-based)
	            1, //last row  (0-based)
	            1, //first column (0-based)
	            2  //last column  (0-based)
	    ));

	    // Style the cell with borders all around.
	    CellStyle style = wb.createCellStyle();
	    style.setBorderLeft(CellStyle.BORDER_THIN);
	    style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
	    style.setBorderRight(CellStyle.BORDER_THIN);
	    style.setRightBorderColor(IndexedColors.BLACK.getIndex());
	    style.setBorderBottom(CellStyle.BORDER_THIN);
	    style.setBottomBorderColor(IndexedColors.BLACK.getIndex());

	    cell.setCellStyle(style);

	    return wb;
}
Comment 1 Gustavo 2012-12-27 21:32:48 UTC
Note:
* I set the Left, Right, and Bottom, but the Right border is not being rendered with BORDER_THIN + BLACK.
* I forgot to remove the comment: // Style the cell with borders all around.
  It can generate mistakes.
Comment 2 Dominik Stadler 2013-06-17 13:42:49 UTC
I just tried it, it will work if you set the same style on the second cell as well:

        cell = row.createCell(2);
        cell.setCellStyle(style);

I am not sure if this is expected behavior or something that should be changed in POI, but at least you can use this as workaround for now.