Skip to main content
All docs

Document.SaveDocument(DocumentFormat) Method

Saves the document to a byte array in the specified file format.

Namespace: DevExpress.XtraRichEdit.API.Native

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

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


byte[] SaveDocument(
    DocumentFormat format


Name Type Description
format DocumentFormat

An enumeration member that specifies the output document format.


Type Description

A byte array that contains data in the specified format.


You can use this SaveDocument method overload to store a document in an external database.

using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
// ...

Document document = richEditControl.Document;

// Save a document to a byte array to store it in a database.
byte[] docBytes = document.SaveDocument(DocumentFormat.OpenXml);

// ...

// Load the saved document from a byte array.
document.LoadDocument(docBytes, DocumentFormat.OpenXml);


The SaveDocument method call does not change the Modified property value.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SaveDocument(DocumentFormat) method.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also