Hi Aspose team,
I using Apsose slides version 22.4. And I want to remove ole object in ppt file.
Here is my current code:
using(var inputStream = new FileStream(@"D:\sample.ppt", FileMode.Open,
FileAccess.Read, FileShare.ReadWrite))
{
Presentation presentation = new Presentation(inputStream);
var slides = new List<IBaseSlide>(presentation.Slides);
foreach(var slide in slides)
{
foreach(var shape in slide.Shapes)
{
if(shape is OleObjectFrame ole)
if(ole.EmbeddedData.EmbeddedFileData != null && ole.EmbeddedData.EmbeddedFileData.Length > 0)
{
ole.ObjectProgId = "";
ole.SetEmbeddedData(new OleEmbeddedDataInfo(Array.Empty<byte>(), "data"));
}
}
}
SaveFormat format = SaveFormat.Ppt;
presentation.Save(@"D:\output.ppt", format);
}
I tried to remove embedded data in ole object by using SetEmbeddedData(), I set it to empty array. When I debug, I see data in EmbeddedFileData removed. But after saving to output file, I use the output for this process at second time, the embedded data is back.
Is this a bug ? Can you give me some advice to remove it ?
Please help me investigate this issue.
sample.zip (329.7 KB)