SetEmbeddedData

OleObjectFrame.SetEmbeddedData method

设置关于 OLE 嵌入数据的信息。此方法更改对象的属性以反映新的数据,并将 IsObjectLink 标志设置为 false,表示 OLE 对象是嵌入的。

public void SetEmbeddedData(IOleEmbeddedDataInfo embeddedData)
ParameterTypeDescription
embeddedDataIOleEmbeddedDataInfo嵌入数据 IOleEmbeddedDataInfo

Exceptions

exceptioncondition
ArgumentNullException当 embeddedData 参数为 null 时。

Examples

[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