Hi,

I have a unit test that causes the creation of an Excel workbook containing a single sheet, with a single columns containing 12 cells.
Each cell was created with a border style going all the way around.
My code has to translate from the source borders to POI/Excel - so I have the following cells/borders even though they don't all exist in POI/Excel:
Solid Black Thin
Solid Black Medium
Solid Black Thick
Dotted Black Thin
Dotted Black Medium
Dotted Black Thick
Dashed Black Thin
Dashed Black Medium
Dashed Black Thick
Double Black Thin
Double Black Medium
Double Black Thick

My issue is that for the XLSX file I'm getting a value of 4 returned by style.getBorder*() when I'm expecting a value of 7 (BORDER_DOTTED).
For XLS I'm getting the expected value; in POI 3.8 I got the expected value.
I don't want to send an unannounced attachment, but I can send you the workbook if that would help.

Is this a bug in POI 3.9?
Does it affect anything other than the reading of one border style in XLSX files?

Thanks.

Jim


In my unit test I have:
private void assertSingleBorder( int row, String border, short expected, short actual ) { // assertEquals( "Row " + row + ", border \"" + border + "\": ", expected, actual );
        if( expected != actual ) {
System.out.println( "Row " + row + ", border \"" + border + "\": " + actual + " != " + expected );
        }
    }


private void assertBorder( Sheet sheet, int row, int col, short bottom, short left, short right, short top ) {

        Cell cell = sheet.getRow(row).getCell(col);
        CellStyle style = cell.getCellStyle();

assertSingleBorder( row, "bottom", bottom, style.getBorderBottom() );
        assertSingleBorder( row, "left", left, style.getBorderLeft() );
        assertSingleBorder( row, "right", right, style.getBorderRight() );
        assertSingleBorder( row, "top", top,    style.getBorderTop() );
    }

...
assertBorder( sheet, i++, 0, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN ); assertBorder( sheet, i++, 0, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM ); assertBorder( sheet, i++, 0, CellStyle.BORDER_THICK, CellStyle.BORDER_THICK, CellStyle.BORDER_THICK, CellStyle.BORDER_THICK );

assertBorder( sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED ); assertBorder( sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED ); assertBorder( sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED );

assertBorder( sheet, i++, 0, CellStyle.BORDER_DASHED, CellStyle.BORDER_DASHED, CellStyle.BORDER_DASHED, CellStyle.BORDER_DASHED ); assertBorder( sheet, i++, 0, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED ); assertBorder( sheet, i++, 0, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED );

assertBorder( sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE ); assertBorder( sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE ); assertBorder( sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE );
...



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to