Skip to main content
All docs

OleFormat.GetRawData() Method

Returns the embedded OLE object’s raw data.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v24.1.Core.dll

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation


byte[] GetRawData()


Type Description

A byte array that contains extracted data. Null (Nothing in Visual Basic) for a linked OLE object.


The following example loads spreadsheet data from a Word document into the Spreadsheet Document API component. You can modify and save this data to a file.


You need a license to the DevExpress Office File API or DevExpress Universal Subscription to use this example in production code. Refer to the following page for pricing information: DevExpress Subscriptions.

using System.Linq;
using DevExpress.XtraRichEdit.API.Native;
// Add references to DevExpress.Docs.dll 
// and DevExpress.Spreadsheet.Core.dll.
using DevExpress.Spreadsheet;
// ...

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)
    // Retrieve data from the OLE object.
    byte[] spreadsheetData = embeddedObject.OleFormat.GetRawData();
    // Create a Workbook instance.
    using (Workbook workbook = new Workbook()) {
        // Load data into the workbook.
        // Modify data.
        // ...

        // Save the document.
        workbook.SaveDocument("ExcelDocument.xlsx", DevExpress.Spreadsheet.DocumentFormat.Xlsx);
See Also