Hi,


I am reading both xlsx and xls sheets.  I want to know if a row is set to 
hidden.
in 3.8-beta4 I am trying this:

            row = sheet.getRow(1);
            cellStyle = row.getRowStyle();
            assertNotNull(cellStyle);
            assertTrue(row.getRowStyle().getHidden());

The cellStyle is Null, so i can't even get to getHidden()

I have seen some posts where people are using setHidden() with success, 
has anyone had success with getHidden() ?

thanks, Chris.
------------------------
see full test below:
------------------------
    @Test
    public void findHiddenRow38() {
        // Read a simple workbook and find rows with 3.8 api
        InputStream stream = null;

        try {
            stream = this.getClass().getResourceAsStream("/hide-row.xlsx");
            Workbook workBook;
            workBook = WorkbookFactory.create(stream);
            Sheet sheet = workBook.getSheetAt(0);
            assertEquals("unit", sheet.getSheetName());

            Row row;
            Cell cell;
            CellStyle cellStyle;
            // Row 0 is not hidden
            row = sheet.getRow(0);
            cell = row.getCell(0);
            assertEquals("1a", cell.getStringCellValue());

            // getRowStyle is new in 3.8 beta 4
            // If there is no whole row style and it is not hidden then 
getRowStyle is null
            cellStyle = row.getRowStyle();
            assertNull(cellStyle);

            // Row 1 is hidden  *** Problem Here ***
            row = sheet.getRow(1);
            cellStyle = row.getRowStyle();
            assertNotNull(cellStyle);
            assertTrue(row.getRowStyle().getHidden());
        }
        catch (Exception exception) {
            assertTrue(exception == null);
        }
        finally {
            if (stream != null) {
                try {
                    stream.close();
                }
                catch (Exception exception) {
                    assertTrue(exception == null);
                }
            }
        }
    }

Reply via email to