ProgId
Contents
[
Hide
]OleFormat.ProgId property
Gets or sets the ProgID of the OLE object.
public string ProgId { get; set; }
Remarks
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.
Examples
Shows how to extract embedded OLE objects into files.
Document doc = new Document(MyDir + "OLE spreadsheet.docm");
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
// The OLE object in the first shape 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 plan on saving the OLE object to a file in the local file system,
// we can use the "SuggestedExtension" property to determine which file extension to apply to the file.
Assert.AreEqual(".xlsx", oleFormat.SuggestedExtension);
// Below are two ways of saving an OLE object to a file in the local file system.
// 1 - Save it via a stream:
using (FileStream fs = new FileStream(ArtifactsDir + "OLE spreadsheet extracted via stream" + oleFormat.SuggestedExtension, FileMode.Create))
{
oleFormat.Save(fs);
}
// 2 - Save it directly to a filename:
oleFormat.Save(ArtifactsDir + "OLE spreadsheet saved directly" + oleFormat.SuggestedExtension);
See Also
- class OleFormat
- namespace Aspose.Words.Drawing
- assembly Aspose.Words