I am trying to embed more files in presentation slide as icon object in c#:
string sOleClassName = string.Empty;
switch(sFileExt)
{
case “.pdf”: sOleClassName = “AcroExch.Document.DC”; break;
case “.docx”:
case “.doc”: sOleClassName = “Word.Document.12”; break;
}
byte[] allbytes = System.IO.File.ReadAllBytes(sFilePath);
IOleObjectFrame oof = newSlide.Shapes.AddOleObjectFrame(x, y, w, h, sOleClassName, allbytes);
oof.IsObjectIcon = true;
For word and excel it works while for pdf, image, etc … i have this error:
“The server application, source file, or item can’t be found, or returned an unknown error. You may need to reinstall the server application.”
What can I do ?
Thanks.
@eXact_learning_solutions,
I have observed the issue shared by you and suggest you to please first try using latest Aspose.Slides 18.8 on your end. If there is still an issue then please provide the working sample code along with source files and generated presentation reproducing the issue on your end.
My code (not work with Aspose.Slides 18.8):
Presentation pres = new Presentation("test.pptx");
ISlide slide = pres.Slides[0];
//Add Ole objects
byte[] allbytes = System.IO.File.ReadAllBytes("test.pdf");
IOleObjectFrame oof = slide.Shapes.AddOleObjectFrame(20, 20, 50, 50, "AcroExch.Document.DC", allbytes);
oof.AlternativeText = "PDF";
oof.IsObjectIcon = true;
allbytes = System.IO.File.ReadAllBytes("test.docx");
oof = slide.Shapes.AddOleObjectFrame(20, 120, 50, 50, "Word.Document.12", allbytes);
oof.AlternativeText = "WORD";
oof.IsObjectIcon = true;
allbytes = System.IO.File.ReadAllBytes("test.xlsx");
oof = slide.Shapes.AddOleObjectFrame(20, 220, 50, 50, "Excel.Sheet.12", allbytes);
oof.AlternativeText = "EXCEL";
oof.IsObjectIcon = true;
allbytes = System.IO.File.ReadAllBytes("test.jpg");
oof = slide.Shapes.AddOleObjectFrame(20, 320, 50, 50, "Paint.Picture", allbytes);
oof.AlternativeText = "JPEG";
oof.IsObjectIcon = true;
pres.Save("testsaved.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
files.zip (406.6 KB)
@eXact_learning_solutions,
I have worked with presentation file shared by you and have been able to observe the issue specified. An issue with ID SLIDESNET-40585 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.
Do you have news about this thread ?
Thanks.
@eXact_learning_solutions,
I have observed your comments. I regret to inform that issue is still under investogation and we will share good news with you soon. I request for your patience.
The issues you have found earlier (filed as SLIDESNET-40585) have been fixed in this update.