Back to Devexpress

ObjectFormatBase.ProgId Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-objectformatbase.md

latest2.8 KB
Original Source

ObjectFormatBase.ProgId Property

Returns the programmatic identifier for an OLE object or ActiveX control.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
string ProgId { get; }
vb
ReadOnly Property ProgId As String

Property Value

TypeDescription
String

A string that defines the object’s ProgID.

|

Example

The following example uses the ProgId property to obtain an OLE object that stores spreadsheet data. The OleFormat.SaveAs method saves extracted data to a file.

csharp
using System.Linq;
using DevExpress.XtraRichEdit.API.Native;
// ...

Document document = wordProcessor.Document;
// Obtain an OLE object that stores spreadsheet data.
DevExpress.XtraRichEdit.API.Native.Shape embeddedObject = document.Shapes.FirstOrDefault(
    x => x.Type == DevExpress.XtraRichEdit.API.Native.ShapeType.OleObject &&
    x.OleFormat.InsertType == OleInsertType.Embedded &&
    x.OleFormat.ProgId == OleObjectType.ExcelWorksheet);

if (embeddedObject != null)
{
    // Save the OLE object's data as an XLSX document.
    embeddedObject.OleFormat.SaveAs("ExcelDocument.xlsx");
}
vb
Imports System.Linq
Imports DevExpress.XtraRichEdit.API.Native
' ...

Dim document As Document = wordProcessor.Document
' Obtain an OLE object that stores spreadsheet data.
Dim embeddedObject As DevExpress.XtraRichEdit.API.Native.Shape = 
    document.Shapes.FirstOrDefault(Function(x) x.Type = 
    DevExpress.XtraRichEdit.API.Native.ShapeType.OleObject _
    AndAlso x.OleFormat.InsertType = OleInsertType.Embedded _
    AndAlso x.OleFormat.ProgId = OleObjectType.ExcelWorksheet)

If embeddedObject IsNot Nothing Then
    ' Save the OLE object's data as an XLSX document.
    embeddedObject.OleFormat.SaveAs("ExcelDocument.xlsx")
End If

See Also

OleObjectType

ObjectFormatBase Interface

ObjectFormatBase Members

DevExpress.XtraRichEdit.API.Native Namespace