Bug 45365

Summary: Converting sheet to csv gives Malformed exponential pattern error
Product: POI Reporter: Tom Corcoran <osssoftware>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: Sheet causing Malformed exponential pattern error when converted to csv
Spfreadsheet where defect reoccurs
Customised XLS2CSVmra used to create problem

Description Tom Corcoran 2008-07-08 12:17:31 UTC
Created attachment 22235 [details]
Sheet causing Malformed exponential pattern error when converted to csv

Using v3.1 (20080629) and the code:
http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java
I am converting many excel workbooks each with many (50+ sheets). For one particular workbook I get an exception, java.lang.IllegalArgumentException with message:
Malformed exponential pattern "0.00E+00". Looking at the workbook in question there seems nothing obvious. Looking at XLS2CSVmra.java, it fails on the line in the porocess() method: 
factory.processWorkbookEvents(request, fs);
I went though all 84 sheets and narrowed it down to the problem sheet (see attached poi.xls). I can't see what the problem is on this sheet, but it gives the Malformed exponential pattern error every time
Comment 1 Nick Burch 2008-07-10 11:41:16 UTC
More crazy excel formatting rules, that java's decimal format doesn't like

Fixed in svn trunk
Comment 2 Tom Corcoran 2008-07-23 04:20:16 UTC
Created attachment 22303 [details]
Spfreadsheet where defect reoccurs

tested with poi-3.2-alpha1-20080717.jar and defect reoccurred for this attached spreadsheet
Comment 3 Tom Corcoran 2008-08-05 16:37:57 UTC
Created attachment 22390 [details]
Customised XLS2CSVmra used to create problem

Changes to downloaded XLS2CSVmra are all wrapped with // TC ADDED. Aside from a package rename the only other changes are confined to some class variable additions & processRecord which use BoundSheetRecord/BOFRecord to output the sheetnames to the csv file.
Comment 4 Nick Burch 2008-08-06 10:52:59 UTC
Your version of XLS2CSVmra is quite old, as it isn't using formatListener.formatNumberDateCell to do the number conversion

Update to a newer version of XLS2CSVmra and you should be fine
Comment 5 Tom Corcoran 2008-08-27 06:10:58 UTC
Confirmation that updating XLS2CSVmra fixed this issue