No real answer as to what is causing the problem but it has to do with the format of the file Gnumeric originally created. Like you, I tried opening the file using POI and saw exactly the same exception thrown. My first response was to unzip the archive and look at the xml only to see that cell A1 was correctly identified to hold a string value. Next, I used Excel to open the file successfully and I saved a copy using that application. POI was able to parse the copy and so I unzipped it to see what the diferences were between the Gnumeric and Excel versions.
The most obvious one is that Excel stores Strings in a separate part of the archive, a 'table' of shared strings that are referenced from the xml for the sheet(s). Secondly, the way excel identifies the type of the data is slightly different, though I do not know if this matters. Excel uses a simple letter 's' while Gnumeric uses 'str'; again, I do not know if this difference matters. It may well be that POI has a much more strict implementation of the OpenXML standard than Gnumeric, OpenOffice or even Excel and that this is causing the problem but, as I have said, I do not know that this is the case. It may be that you will need to wait until one of the developers is able to answer your question for a definitive response. Also, have you tried searching back through the list to see if anyone else has encoountered similar problems with Gnumeric files? Yours Mark B Bugzilla from [email protected] wrote: > > https://issues.apache.org/bugzilla/show_bug.cgi?id=47889 > > Summary: NumberFormatException when calling > XSSFCell.getStringCellValue() on cell with a string > Product: POI > Version: 3.5-dev > Platform: PC > OS/Version: Linux > Status: NEW > Severity: normal > Priority: P2 > Component: XSSF > AssignedTo: [email protected] > ReportedBy: [email protected] > > > Created an attachment (id=24303) > --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24303) > Problematic worksheet > > When loading the example worksheet (see attached) using POI 3.5beta6, a > call to > getStringCellValue results in a number formal exception for cell A1 (first > row, > first column). This cell contains the letter 'a' only. While the > worksheet is > created with Gnumeric, it does load properly in Gnumeric and OpenOffice. > > The following is the exception: > > java.lang.NumberFormatException: For input string: "a" > at > java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) > at java.lang.Integer.parseInt(Integer.java:481) > at java.lang.Integer.parseInt(Integer.java:514) > at > org.apache.poi.xssf.usermodel.XSSFCell.getRichStringCellValue(XSSFCell.java:257) > at > org.apache.poi.xssf.usermodel.XSSFCell.getStringCellValue(XSSFCell.java:225) > ... > > The call on line 225 seems to suggest that the cell is identified as > containing > a string. > > -- > Configure bugmail: > https://issues.apache.org/bugzilla/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You are the assignee for the bug. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > -- View this message in context: http://www.nabble.com/DO-NOT-REPLY--Bug-47889--New%3A-NumberFormatException-when-calling-XSSFCell.getStringCellValue%28%29-on-cell-with-a-string-tp25570304p25607157.html Sent from the POI - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
