Bug 55033 - new XSSFWorkbook(pkg) corrupts Excel file
Summary: new XSSFWorkbook(pkg) corrupts Excel file
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.9-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2013-05-31 08:58 UTC by est412
Modified: 2015-09-07 20:15 UTC (History)
0 users

Corrupted file (6.56 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2013-05-31 08:58 UTC, est412
Initial and rezulting test files (16.44 KB, application/octet-stream)
2013-05-31 10:09 UTC, est412

Note You need to log in before you can comment on or make changes to this bug.
Description est412 2013-05-31 08:58:22 UTC
Created attachment 30347 [details]
Corrupted file

This simple piece of code corrupts normal *.xlsx file.

pkg = OPCPackage.open(args[0]);
wb = new XSSFWorkbook(pkg);

Without statement 
wb = new XSSFWorkbook(pkg);
*.xlsx file remains good.

Corrupted *.xlsx attached.
Thanx in advance!
Comment 1 Nick Burch 2013-05-31 09:05:02 UTC
Are you able to work out how the files differ? (You'll probably need to unzip both, then do a whitespace ignoring diff / xmllint -format then diff to work out the changes)
Comment 2 est412 2013-05-31 10:09:55 UTC
Created attachment 30348 [details]
Initial and rezulting test files
Comment 3 est412 2013-05-31 10:11:37 UTC
Unfortunately I not feel qualified enough to diff this files.
Attaching all of it instead.
Comment 4 Dominik Stadler 2015-09-07 20:15:18 UTC
I think this was fixed a long time ago. Nowadays you can also use open(String path, PackageAccess access) with PackageAccess.READ to avoid any writing back of the file.

Please reopen or submit a new bug report if there is still a problem with the latest version of POI.