Bug 45365 - Converting sheet to csv gives Malformed exponential pattern error
Summary: Converting sheet to csv gives Malformed exponential pattern error
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-08 12:17 UTC by Tom Corcoran
Modified: 2008-08-27 06:10 UTC (History)
0 users



Attachments
Sheet causing Malformed exponential pattern error when converted to csv (50.50 KB, application/vnd.ms-excel)
2008-07-08 12:17 UTC, Tom Corcoran
Details
Spfreadsheet where defect reoccurs (163.50 KB, application/vnd.ms-excel)
2008-07-23 04:20 UTC, Tom Corcoran
Details
Customised XLS2CSVmra used to create problem (12.87 KB, application/octet-stream)
2008-08-05 16:37 UTC, Tom Corcoran
Details

Note You need to log in before you can comment on or make changes to this bug.
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