I am adding a few different file types to slides in powerpoint. These types include mp4, zip, swf, and other formats. I am not looking for a way to play these file types back; however, I’d like to store and retrieve files from within a powerpoint preso.
I’ve successfully stored these various file types by doing the following:
currentSlide.Shapes.AddOLEObject(0, 0, -1, -1, "", this.filePath);
I can also retrieve them manually by Right Clicking the Object -> Selecting Edit Package -> File -> Save Content.
I am looking to replicate or use this functionality to save the contents of the OLEObject back to its original state and to a path I specify. I have a way to find that shape and I think this object contains the contents: slideShape.OLEFormat.ObjectI just don’t know what to do now. Ideas? Thanks.
Oh I am using office 2010, if that makes any sort of difference.
So, I know this is late; however, I know others must have similar questions.
I contacted Microsoft about this issue and it took them around a month or so, but they finally got me an answer. I have a zip of the solution. It is fairly extensive, look below for just plain source code.
First some instructions:
1) Create a PowerPoint presentation and embed some files in it (Video, mp3, zip etc)
2) Save the file to the following location C:\Temp\Temp.pptx
3) Close the file
4) Create a folder “GeneratedFiles” under “C:\Temp”
5) Open the application and run it.
So the only downside is that the PPTX file must be closed. That being said, one might be able to copy the open PPTX file elsewhere and then extracted the files from that location rather than the PPTX that is actually being worked on. Then just delete the temporary one. We will see. This is as close as this solution gets though.
Without further adieu: