officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-document-dot-savedocument-x28-devexpress-dot-xtrarichedit-dot-documentformat-x29.md
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
byte[] SaveDocument(
DocumentFormat format
)
Function SaveDocument(
format As DocumentFormat
) As Byte()
| Name | Type | Description |
|---|---|---|
| format | DocumentFormat |
An enumeration member that specifies the output document format.
|
| Type | Description |
|---|---|
| Byte[] |
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.Docx);
// ...
// Load the saved document from a byte array.
document.LoadDocument(docBytes, DocumentFormat.Docx);
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