Bug 7755

Summary: Boolean Cells are ignored when reading .xls file
Product: POI Reporter: Doug Bitting <douglas.bitting>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Doug Bitting 2002-04-05 03:41:45 UTC
I have an Excel 2000 file with 10 columns, 2 of which are boolean.  For the 
particular row in question, HSSFRow.getPhysicalNumberOfCells() reports 8 
cells.  The boolean cells are returned as <code>null</code> from HSSFRow.getCell
().
Comment 1 Glen Stampoultzis 2002-04-08 14:23:32 UTC
Here's a test case that confirms the bug.  A comment in the code indicates that 
this bug may be a known issue.

public void testReadBooleans()
            throws Exception
    {
        HSSFWorkbook workbook = new HSSFWorkbook();
        HSSFSheet sheet = workbook.createSheet("Test boolean");
        HSSFRow row = sheet.createRow((short)2);
        HSSFCell cell = row.createCell((short)9);
        cell.setCellValue(true);
        cell = row.createCell((short)11);
        cell.setCellValue(true);
        File tempFile = File.createTempFile("bool", "test.xls");
        FileOutputStream stream = new FileOutputStream(tempFile);
        workbook.write(stream);
        stream.close();

        FileInputStream readStream = new FileInputStream(tempFile);
        workbook = new HSSFWorkbook(readStream);
        sheet = workbook.getSheetAt(0);
        row = sheet.getRow(2);
        stream.close();
        tempFile.delete();
        assertEquals(2, row.getPhysicalNumberOfCells());


    }
Comment 2 Glen Stampoultzis 2002-04-10 12:29:33 UTC
Nope, not a known issue...  I think it may have been my fault.  BoolErr record 
was missing from the RecordGenerator class.  I will be submitting a fix as soon 
as CVS finishes updating (which could take a while over my 33.6k modem.
Comment 3 Glen Stampoultzis 2002-04-10 13:00:17 UTC
Fixed.  Will be available on upcoming 1.5 release.