SetEmbeddedData

IOleObjectFrame.SetEmbeddedData method

Sets information about OLE embedded data.

public void SetEmbeddedData(IOleEmbeddedDataInfo embeddedData)
Parameter Type Description
embeddedData IOleEmbeddedDataInfo Embedded data IOleEmbeddedDataInfo

Exceptions

exception condition
ArgumentNullException When embeddedData parameter is null.

Remarks

This method changes the properties of the object to reflect the new data and sets the IsObjectLink flag to false, indicating that the OLE object is embedded.

Examples

Following example demonstrates how to change OLE embedded data and its type for existing IOleObjectFrame object

[C#]
using (Presentation pres = new Presentation("SomePresentation.pptx"))
{
    OleObjectFrame oof = pres.Slides[0].Shapes[0] as OleObjectFrame;
    if (oof != null)
    {
        IOleEmbeddedDataInfo newData = new OleEmbeddedDataInfo(File.ReadAllBytes("Picture.png"), "png");
        oof.SetEmbeddedData(newData);
    }
}

See Also