Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RichEditDocumentServer.SaveDocument(DocumentFormat, EncryptionSettings) Method

Saves the document to a byte array in the specified file format and encrypts it with a password.

Namespace: DevExpress.XtraRichEdit

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

NuGet Package: DevExpress.RichEdit.Core

#Declaration

public byte[] SaveDocument(
    DocumentFormat documentFormat,
    EncryptionSettings encryptionSettings
)

#Parameters

Name Type Description
documentFormat DocumentFormat

An enumeration member that specifies the output document format.

encryptionSettings EncryptionSettings

Specifies encryption settings.

#Returns

Type Description
Byte[]

A byte array that contains encrypted data in the specified format.

#Remarks

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

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

using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
    // Specify encryption settings.
    EncryptionSettings encryptionSettings = new EncryptionSettings
    {
        Type = EncryptionType.Strong,
        Password = "password"
    };

// Save the document to a byte array.
byte[] docBytes = wordProcessor.SaveDocument(DocumentFormat.OpenXml, encryptionSettings);
}
See Also