We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

AddOleObjectFrame not embedding Excel Document

I want to dynamically embed an Excel document into a slide so users can click on the OLE object icon and view the Excel document. I’m adding an OLE object by using AddOleObjectFrame. When I open the saved pptx file it shows a box with red “Embeded OLE Object” text. When I try to click the object I get an error: The server application, source file, or item can’t be found…

sample code:

Workbook wbEmbed = new Workbook(excelFileName);
MemoryStream msout = new MemoryStream();
wbEmbed.Save(msout, SaveFormat.Xlsx);
IOleObjectFrame oof = docSlide.Shapes.AddOleObjectFrame(200, 200, 90, 90, “Worksheet”, msout.ToArray());
oof.IsObjectIcon = true;

I verified that the memory stream object contains the Excel document by updating an existing OleObjectFrame that I added manually to the PowerPoint document.

OK… I got the OleObject working. When I double click it, it now opens the embedded Excel Document.

Made the following changes:

IOleObjectFrame oof = documentsSlide.Shapes.AddOleObjectFrame(200, 200, 90, 90, “Excel.Sheet.12”, msout.ToArray());
oof.ObjectProgId = “Excel.Sheet.12”;
oof.ObjectName = “Worksheet”;
oof.IsObjectIcon = true;

Now my problem is getting the Excel Worksheet Icon to display with a custom caption. How does this work?

I now have the image filled in, but I’m stilling getting “Embedded OLE Object” in red in the frame.

Code for filling image in:

oof.FillFormat.FillType = FillType.Picture;
oof.FillFormat.PictureFillFormat.PictureFillMode = PictureFillMode.Stretch;
System.Drawing.Image img = (System.Drawing.Image)new Bitmap(“myimage.png”);
IPPImage imgx = MyPresentation.Images.AddImage(img);
oof.FillFormat.PictureFillFormat.Picture.Image = imgx;

How do I get rid of the bold red “Embedded OLE Object”???

Hi Marcellus,

Thank your for inquiring Aspose.Slides.

I have observed the requirements shared by you and like to share that
whenever you add an ole object frame to slide, it gets added in disabled
form. The red message show “Embedded Object”
highlights that Ole object has been added but it is in not activated.
One need to active the Ole frame to show the Ole object content. There
are two approaches that one can use in this regard. First is to use
third party macros that will look for embedded ole objects inside
presentation and activate the Ole frames whenever presentation is
opened. You may please follow this documentation link
for your kind reference in this regard to have an idea. But you need to
look for available options for use of third party to the job for you on
your end in this regard.

Many Thanks,