All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

OleFormat.SaveAs(Stream) Method

Saves data of the embedded OLE object to a stream.

Namespace: DevExpress.XtraRichEdit.API.Native

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

Declaration

void SaveAs(
    Stream stream
)

Parameters

Name Type Description
stream Stream

The output stream.

Exceptions

Type Description
InvalidOperationException

Occurs when you call the SaveAs method for a linked OLE object.

Remarks

The following example shows how to save an embedded OLE object’s data:

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.
    using (FileStream stream = new FileStream(@"D:\ExcelDocument.xlsx",
        FileMode.Create, FileAccess.ReadWrite))
    {
        embeddedObject.OleFormat.SaveAs(stream);
    }
}
See Also