Bug 47479

Summary: 'initialisation of record 0x205 left 1 bytes remaining still to be read', when BOOLEAN values in the spreadsheet
Product: POI Reporter: Vesa Akerman <vesa_akerman>
Component: HSSFAssignee: POI Developers List <dev>
Severity: critical    
Priority: P1    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: Macintosh   
OS: Linux   

Description Vesa Akerman 2009-07-06 05:22:38 UTC
Gives this error when creating new HSSFWorkbook.  The excel file was made with OpenOffice 3.0, and converted to Microsoft Excel 97/... format.
This error occurs ONLY WHEN THERE ARE BOOLEAN VALUES in the spreadsheet!
Comment 1 Josh Micich 2009-07-06 13:06:27 UTC
I think the mistake is in OOO Calc - line 651 of xetable.cxx:
This is inconsistent with the documentation.

I would propose this fix:

Index: xetable.cxx
--- xetable.cxx (revision 268869)
+++ xetable.cxx (working copy)
@@ -648,7 +648,7 @@

 void XclExpBooleanCell::WriteContents( XclExpStream& rStrm )
-    rStrm << sal_uInt16( mbValue ? 1 : 0 ) << EXC_BOOLERR_BOOL;
+    rStrm << sal_uInt8( mbValue ? 1 : 0 ) << EXC_BOOLERR_BOOL;

 // ----------------------------------------------------------------------------

I guess Excel is able to read the file because the desired value of 0 (==EXC_BOOLERR_BOOL) still gets written to the second data byte.  

Fixed in svn r791595

I wrote a unit test to reproduce the problem and also modified POI to tolerate the OOO Calc bug.