Bug 60187

Summary: RegionUtil should use new enum style classes
Product: POI Reporter: Guillaume Camus <camusg>
Component: SS CommonAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: 3.15-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   
Bug Depends on:    
Bug Blocks: 59836    

Description Guillaume Camus 2016-09-29 12:39:21 UTC
RegionUtil has to change some methods to switch old int/short value to new enums classes (like BorderStyle, HorizontalAlignment, FillPatternType...)

Actually, with version 3.15, we have some output lines like :
BorderStyle short usage

I use RegionUtil with merged zones, to put some border, with the following code :
protected static void addMergedRegion(Sheet sheet, int iRowMin, int iRowMax, int iColMin, int iColMax) {
    CellRangeAddress cellZone = new CellRangeAddress(iRowMin, iRowMax, iColMin, iColMax);

    Cell cell = sheet.getRow(iRowMin).getCell(iColMin);
    if (cell != null) {
        RegionUtil.setBorderBottom(cell.getCellStyle().getBorderBottomEnum().getCode(), cellZone, sheet);
        RegionUtil.setBorderTop(cell.getCellStyle().getBorderTopEnum().getCode(), cellZone, sheet);
        RegionUtil.setBorderLeft(cell.getCellStyle().getBorderLeftEnum().getCode(), cellZone, sheet);
        RegionUtil.setBorderRight(cell.getCellStyle().getBorderRightEnum().getCode(), cellZone, sheet);

        RegionUtil.setBottomBorderColor(cell.getCellStyle().getBottomBorderColor(), cellZone, sheet);
        RegionUtil.setTopBorderColor(cell.getCellStyle().getTopBorderColor(), cellZone, sheet);
        RegionUtil.setLeftBorderColor(cell.getCellStyle().getLeftBorderColor(), cellZone, sheet);
        RegionUtil.setRightBorderColor(cell.getCellStyle().getRightBorderColor(), cellZone, sheet);

Maybe, there is a new way to do the same thing, but I don't find it.

I have submitted a question here :
Comment 1 Javen O'Neal 2016-09-30 06:46:43 UTC
Added in r1762856.

I believe only BorderStyle applies to setBorderLeft|Right|Top|Bottom. Fill pattern and text alignment in a cell is currently not handled by RegionUtil.setBorderLeft|Right|Top|Bottom.

See bug 58787 for some potential future changes to work with multi-cell regions.
Comment 2 Javen O'Neal 2016-09-30 07:02:53 UTC
And r1762859 so that the new methods don't log a BorderStyle short usage warning in the POI logger.