Page 1 of 1

Corrupt powerpoint file containing spreadsheet

PostPosted: Fri Nov 02, 2012 9:39 pm
by gonstr
Hello!

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.

Re: Corrupt powerpoint file containing spreadsheet

PostPosted: Fri Nov 02, 2012 10:54 pm
by jason
Hi

Round tripping your input file works for me.

So I tried to compare your output.pptx with my output using the Open XML SDK 2.0 tool.

It threw up the attached error, which looks like a clue as to what is going wrong for you.

cheers .. Jason

Re: Corrupt powerpoint file containing spreadsheet

PostPosted: Sat Nov 03, 2012 1:25 am
by gonstr
Thanks for the quick reply! I got the roundtrip working now. Was some problem with my libraries i believe