Bug 59358 - save xlsx is not possible
Summary: save xlsx is not possible
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.14-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-20 12:03 UTC by Ivan Horvath
Modified: 2016-05-17 19:32 UTC (History)
0 users



Attachments
netbeans project and sample xlsx (22.70 KB, application/octet-stream)
2016-04-20 12:06 UTC, Ivan Horvath
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Horvath 2016-04-20 12:03:43 UTC
Hi,

i need to make some change on an existing xlsx file, and save it with a new name.
tried to follow the examples, but didn't work with my solution

test2.xlsx is the existing file, i would like to open..modify..save to a new name
netbeans project is attached too

thanks in advance for your help!
Ivan
Comment 1 Ivan Horvath 2016-04-20 12:06:56 UTC
Created attachment 33781 [details]
netbeans project and sample xlsx
Comment 2 Dominik Stadler 2016-05-17 19:32:03 UTC
This is likely due to the fact that you close the OPCPackage while the Workbook is still accessed, you should rather use the constructor of XSSFWorkbook which receives a filename instead to keep resources open until the workbook is closed at the end.

    try (OPCPackage pkg = OPCPackage.open(new File(filename))) {
      _WB = new XSSFWorkbook(pkg);
    }

If that does not solve the problem, then please reopen this bug with a more reduced test-case that shows your problem with as little code as possible.