Bug 56278

Summary: Workbook Opens in Excel But Not POI Due To NPE
Product: POI Reporter: Greg Leib <leibge>
Component: XSSFAssignee: POI Developers List <dev>
Severity: normal CC: baddamsravanthi
Priority: P2    
Version: 3.10-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.4   
Attachments: File opens in Excel but not in POI

Description Greg Leib 2014-03-17 18:09:45 UTC
Created attachment 31395 [details]
File opens in Excel but not in POI

I am trying to open a workbook that I believe is in XLSX format from an older version of Excel. I'm not entirely sure of the file format, because the file was downloaded from http://members.fhlbdm.com/member-tools/advance-rates/csv/ which is a banking website not under my control. I am able to open the file directly in Excel, but not in POI. Here's the stack trace I'm getting when I try to create a new XSSF workbook using an input stream of the file:

	at org.apache.poi.xssf.usermodel.XSSFWorkbook.onDocumentRead(XSSFWorkbook.java:284)
	at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:159)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:221)

Please find the file attached. I'm running JDK 7 update 51 and this trace was taken from a JUnit test case executed in IntelliJ IDEA. I'm using POI with the OOXML module, built using Maven.

I've tried searching the internet for this exception, and I see a few descriptions of similar behavior but no resolutions. The following external link may also be related http://stackoverflow.com/questions/18274995/nullpointerexception-when-trying-to-read-xlsx-file as it is also a Mac and a similar error. In this tracker, my problem may be related to ticket 16488, since the spreadsheet does have some cells with Excel warnings. 

Thanks in advance!
Comment 1 Nick Burch 2014-03-17 19:02:43 UTC
Your file is missing a styles table, which we assumed files would always have

Fixed in r1578518 - we now create one if missing, just as we do for a missing SST
Comment 2 Greg Leib 2014-03-17 20:43:06 UTC
Thank you Nick!
Comment 3 Dominik Stadler 2014-05-14 20:19:32 UTC
*** Bug 56490 has been marked as a duplicate of this bug. ***