0

If I do the following:

Path originalPath = Paths.get("src/test/resources/ORIGINAL.xlsm");
File originalFile = copyPath.toFile()
Workbook workbook = WorkbookFactory.create(originalFile);
//Populate with some values
FileOutputStream fileOut = new FileOutputStream("src/test/resources/TEST.xlsm");
workbook.write(fileOut);

Then both TEST.xlsm and ORIGINAL.xlsm will be populated with values

If I don't use write(), of course no TEST.xlsm will be created, but also nothing will be updated in ORIGINAL.xlsm

However if i do

workbook.write(System.out);

then ORIGINAL.xlsm will be updated

Why is it so that write will write the workbook, it says nothing in the documentation about that?

JavaDoc: "Write out this workbook to an Outputstream."

Is there any other way of only updating the ORIGINAL.xlsm?

2
  • What version of Apache POI are you facing this with?
    – Gagravarr
    Apr 29, 2015 at 15:43
  • That's an odd version to pick. What happens if you try the latest, 3.12-beta1? (Or wait a week or so, and try 3.12 final)
    – Gagravarr
    Apr 30, 2015 at 8:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.