Bug 66360 - Row Span borders render not correctly working with RegionUtil
Summary: Row Span borders render not correctly working with RegionUtil
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 5.2.2-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-22 09:18 UTC by vincent.lelostec
Modified: 2022-11-23 13:37 UTC (History)
0 users



Attachments
Expected borders and reality (1.37 KB, image/png)
2022-11-22 09:18 UTC, vincent.lelostec
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vincent.lelostec 2022-11-22 09:18:14 UTC
Created attachment 38438 [details]
Expected borders and reality

Hi there,

I'm facing an issue trying to set borders on an merged region applying a Row Span. The version I uesd is 5.2.3 but not listed here.

the code used bellow :

if (!BorderStyle.NONE.equals(excelStyle.getBorderBottom())) {
  RegionUtil.setBorderBottom(excelStyle.getBorderBottom(), mergedRegion, excelSheet);
  RegionUtil.setBottomBorderColor(excelStyle.getBottomBorderColor(), mergedRegion, excelSheet);
}

if (!BorderStyle.NONE.equals(excelStyle.getBorderTop())) {
  RegionUtil.setBorderTop(excelStyle.getBorderTop(), mergedRegion, excelSheet);
  RegionUtil.setTopBorderColor(excelStyle.getTopBorderColor(), mergedRegion, excelSheet);
}

if (!BorderStyle.NONE.equals(excelStyle.getBorderLeft())) {
  RegionUtil.setBorderLeft(excelStyle.getBorderLeft(), mergedRegion, excelSheet);
  RegionUtil.setLeftBorderColor(excelStyle.getLeftBorderColor(), mergedRegion, excelSheet);
}

if (!BorderStyle.NONE.equals(excelStyle.getBorderRight())) {
  RegionUtil.setBorderRight(excelStyle.getBorderRight(), mergedRegion, excelSheet);
  RegionUtil.setRightBorderColor(excelStyle.getRightBorderColor(), mergedRegion, excelSheet);
}

In my tests i go throughout all conditions, this works good for the Column span, But for the Row span the behavior of the borders isn't the one I expected (see the attachments).

The script of the code is this : 

 - I compute the XSSFCellStyle
 - Then I apply the style to the current cell
 - And finaly, if a span is defined on this cell, I create a CellRangeAddress, add it to the merged regions and apply the borders with the code above.

I try differents scripts (create the merged region before applying styles...) but the result is always the same as the attachment. 

Is this a bug or I missused RegionUtil ?

Thanks.
Comment 1 vincent.lelostec 2022-11-23 13:37:44 UTC
I there, I tried many solutions but it seems that I made a mistake using RegionUtil with XSSF styles.

I fix all my borders issues (style and colors) by setting the style wanted in all the cell being part of the merged region (before that, I only created the first cell of the merged region, applied the style to it and then created the merged region and I think this is the problem)

I close the issue.