Object Preview Issue when Adding OleObjectFrame

Introduction

Using Aspose.Slides for .NET, when you add OleObjectFrame to a slide, an “EMBEDDED OLE OBJECT” message is shown on the output slide. This message is intentional and NOT a bug.

For more information on working with OLE objects, see Manage OLE.

Explanation and Solution

Aspose.Slides displays the “EMBEDDED OLE OBJECT” message to notify you that the OLE object has been changed and the preview image has to be updated.

For example, if you add a Microsoft Excel сhart as an OleObjectFrame to a slide (for more details, see the “Manage OLE” article) and then open the presentation in the Microsoft PowerPoint, you will see this image on the slide:

OLE object message

If you want to check and confirm that your OLE object was added to the slide, you have to double-click on the “EMBEDDED OLE OBJECT” message, or you can right-click on it and go through Object > Edit option.

OLE object > Edit

PowerPoint then opens the embedded OLE object.

OLE object data

The slide may retain the “EMBEDDED OLE OBJECT” message. Once you click the OLE object, the slide preview gets updated and the “EMBEDDED OLE OBJECT” message is replaced by the actual image for the OLE object.

OLE object preview

Now, you may want to save your presentation to ensure the image for the OLE Object gets updated correctly. This way, after saving the presentation, when you open the presentation again, you will NOT see the “EMBEDDED OLE OBJECT” message.

Other Solutions

Solution 1: Replace the “Embedded OLE Object” Message with an Image

If you do not want to remove the “EMBEDDED OLE OBJECT” message by opening the presentation in PowerPoint and then saving it, you can replace the message with your preferred preview image. These lines of code demonstrate the process:

using var presentation = new Presentation("embeddedOLE.pptx");

var slide = presentation.Slides[0];
var oleFrame = (IOleObjectFrame)slide.Shapes[0];

// Add an image to presentation resources.
using var imageStream = File.OpenRead("myImage.png");
var oleImage = presentation.Images.AddImage(imageStream);

// Set a title and the image for the OLE object preview.
oleFrame.SubstitutePictureTitle = "My title";
oleFrame.SubstitutePictureFormat.Picture.Image = oleImage;
oleFrame.IsObjectIcon = false;

presentation.Save("embeddedOLE-newImage.pptx", SaveFormat.Pptx);

The slide containing the OleObjectFrame then changes to this:

New OLE object image

Solution 2: Create an Add-On for PowerPoint

You can also create an add-on for Microsoft PowerPoint that updates all OLE objects when you open presentations in the program.