OleFormatProgId Property |
Namespace: Aspose.Words.Drawing
The ProgID property is not always present in Microsoft Word documents and cannot be relied upon.
Cannot be null.
The default value is an empty string.
Document doc = new Document(MyDir + "OLE spreadsheet.docm"); // The first shape will contain an OLE object Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true); // This object is a Microsoft Excel spreadsheet OleFormat oleFormat = shape.OleFormat; Assert.AreEqual("Excel.Sheet.12", oleFormat.ProgId); // Our object is neither auto updating nor locked from updates Assert.False(oleFormat.AutoUpdate); Assert.AreEqual(false, oleFormat.IsLocked); // If we want to extract the OLE object by saving it into our local file system, this property can tell us the relevant file extension Assert.AreEqual(".xlsx", oleFormat.SuggestedExtension); // We can save it via a stream using (FileStream fs = new FileStream(ArtifactsDir + "OLE spreadsheet extracted via stream" + oleFormat.SuggestedExtension, FileMode.Create)) { oleFormat.Save(fs); } // We can also save it directly to a file oleFormat.Save(ArtifactsDir + "OLE spreadsheet saved directly" + oleFormat.SuggestedExtension);