dhatim / fastexcel

Generate and read big Excel files quickly
Other
684 stars 122 forks source link

getCellAsBoolean always returns true #77

Closed djuju08 closed 5 years ago

djuju08 commented 5 years ago

I think there is an issue with the getCellAsBoolean method of the Row.java class.

If a boolean value is set in the cell (TRUE or FALSE), the value retrieved by the library is always true.

rzymek commented 5 years ago

Confirmed. With this xlsx the following test fails:

@Test
public void asBoolean() throws Exception {
    try (InputStream is = openResource("/xlsx/simple.xlsx"); ReadableWorkbook wb = new ReadableWorkbook(is)) {
        List<Boolean> cells = wb.getFirstSheet().openStream()
                .flatMap(r -> r.stream())
                .filter(c -> !CellType.EMPTY.equals(c.getType()))
                .map(c -> c.asBoolean())
                .collect(toList());
        assertEquals(Arrays.asList(true,false), cells);
    }
}
rzymek commented 5 years ago

Self contained test using fastexcel writer and reader: https://github.com/rzymek/issue77 Also fails.