Back to Devexpress

Document.SaveDocument(DocumentFormat) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-document-dot-savedocument-x28-devexpress-dot-xtrarichedit-dot-documentformat-x29.md

latest2.5 KB
Original Source

Document.SaveDocument(DocumentFormat) Method

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

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
byte[] SaveDocument(
    DocumentFormat format
)
vb
Function SaveDocument(
    format As DocumentFormat
) As Byte()

Parameters

NameTypeDescription
formatDocumentFormat

An enumeration member that specifies the output document format.

|

Returns

TypeDescription
Byte[]

A byte array that contains data in the specified format.

|

Remarks

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

csharp
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.Docx);

// ...

// Load the saved document from a byte array.
document.LoadDocument(docBytes, DocumentFormat.Docx);
vb
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
' ...

Dim document As Document = richEditControl.Document

' Save a document to a byte array to store it in a database.
Dim docBytes() As Byte = document.SaveDocument(DocumentFormat.Docx)

' ...

' Load the saved document from a byte array.
document.LoadDocument(docBytes, DocumentFormat.Docx)

Note

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

See Also

Document Interface

Document Members

DevExpress.XtraRichEdit.API.Native Namespace