Opening and re-saving a .ppt file with Aspose.Slides corrupts OLE links.
Aspose.Slides versions: 18.12 and 19.9
My code:
private static void Main()
{
var fullFilePath = Path.GetFullPath(TestFilePath + @"\" + TestFileName);
using (var fileStream = new FileStream(fullFilePath, FileMode.OpenOrCreate))
{
var presentation = new Presentation(fileStream);
var sourceFormat = presentation.SourceFormat;
presentation.Save(fullFilePath.Replace(@".ppt", @" (Result).ppt"), GetSaveFormat(sourceFormat));
}
}
private static SaveFormat GetSaveFormat(SourceFormat sourceFormat)
{
switch (sourceFormat)
{
case SourceFormat.Ppt:
return SaveFormat.Ppt;
default:
return SaveFormat.Pptx;
}
}
Attached is a small VS 2017 Solution that demonstrates this OLE-link corruption on an example .ppt file.
HERE: AsposePowerPoint.zip - Google Drive
You will have to re-link the child file in the parent file before running the application and experiencing this bug.
After opening and re-saving a .ppt file with an OLE link, the OLE link is changed from:
X:\path to files\child file.xls!...
to X:\path to files\parent file.ppt\child file.xls!...