I want to be able to replace an embedded .xlsx in a .pptx.
First step I did was create a simple .pptx file in Powerpoint which contains one slide and imported a spreadsheet from Excel in it.
I tried to replace the embedded .xlsx file but ran in to some trouble with corrupted files. Then found out that just doing this causes the .pptx to be corrupt:
- Code: Select all
PresentationMLPackage ppt = PresentationMLPackage.load(new File("input.pptx"));
ppt.save(new File("output.pptx"));
When trying to open output.pptx Powerpoint complains and wants to repair the file. Repairing it works and its then possible to open the file and see the embedded spreadsheet.
If i dont import a spreadsheet but put some other random stuff in the slide everything seems to work. Its definitely connected to the embedded .xlsx file.
Using 2.8.1 and Excel/Powerpoint 2011 for mac to create the initial .pptx/.xlsx files. I attached the input and output files.