https://issues.apache.org/bugzilla/show_bug.cgi?id=56957

            Bug ID: 56957
           Summary: Excel 2007 file is unusable after closing Workbook
                    object
           Product: POI
           Version: 3.11-dev
          Hardware: PC
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: XSSF
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 31999
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31999&action=edit
excel files and java source file

I am reading an Excel 2007 file(xlsx format). After the first read, when I
close the Workbook object, the second time I run the Java application, I get
exception in Eclipse.

I am using the latest release of POI available in maven repositories, i.e. 3.11
beta2. Tested on both Windows and Linux, Java 7 and Java 8, the problem
persists in all cases

This happens ONLY on Microsoft Excel 2007 XLSX files. It does not happen when
using Microsoft Excel 2013 XLSX files.

///////////////////////////////////////////////////////////////////
The error I am getting in Eclipse console is the following:

Exception in thread "main" org.apache.poi.POIXMLException:
java.lang.reflect.InvocationTargetException
    at
org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
    at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:427)
    at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:162)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:236)
    at
org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:109)
    at Main.main(Main.java:17)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at
org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:60)
    ... 5 more
Caused by: java.io.IOException: error: Unexpected end of file after null
    at
org.apache.poi.xssf.model.SharedStringsTable.readFrom(SharedStringsTable.java:129)
    at
org.apache.poi.xssf.model.SharedStringsTable.<init>(SharedStringsTable.java:106)
    ... 10 more
//////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
The error I am getting from Microsoft Excel 2007 when opening the file after
this corruption, is the following:
"Excel found unreadable content in 'file_name.xlsx'. Do you want to recover the
contents of this workbook?"
When answering yes, it says:
"Excel was able to open the file by repairing or removing the unreadable
content. Removed Part: /xl/sharedStrings.xml part with XML error.  (Strings) A
document must contain exactly one root element. Line 1, column 0."
///////////////////////////////////////////////////////////////////////////
I also attach
1. the Java source file I used to read the file(Main.java), and 
2. the Excel 2007 XLSX file before corruption(Excel_2007_file_before.xlsx) and
after corruption(Excel_2007_file_after.xlsx)
The files are in 'all.zip' file

-- 
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]

Reply via email to