I’m trying to edit and replace embedded ole objects in presentations. I followed this instruction but it doesn’t work as I expected.
For example:
My pptx file has two embedded file a ppt and another pptx. There was no problem with the ppt I could edit and replace it but when I replaced the embedded pptx like this:
// Changing Ole frame object data
msout.Position = 0;
ole.ObjectData = msout.ToArray();
The replaced pptx Ole Object properties changed to this:
EmbeddedFileName: /ppt/embeddings/oleObject2.bin
EmbeddedFileExtension: .bin
(MS PowerPoint 2016 cannot handled this embedded file after the replace, when I extracted the embedded file manually and replaced the .bin extension to .pptx I could open and see the changes in the file)
The original was this:
EmbeddedFileName: /ppt/embeddings/oleObject2.bin
EmbeddedFileExtension: .pptx
Can I replace all kinds of Ole Object data using the ObjectData property?
I tried another method to replace Ole Objects:
- Get and edit the embedded file stream
- Add a new Ole Object to the original position with AddOleObjectFrame
- Remove the original Ole Object from the Slide
My problem with this, there will be the Changed Object image on the slide as you mentioned here. I wanted to change the image as it is in the example but there is no PictureId property in the IOleObjectFrame interface.
So my other question is: how could I change the added IOleObjectFrame image on the slide?