Back to Devexpress

RichEditDocumentServer.SaveDocument(Stream, DocumentFormat, EncryptionSettings) Method

officefileapi-devexpress-dot-xtrarichedit-dot-richeditdocumentserver-dot-savedocument-x28-system-dot-io-dot-stream-devexpress-dot-xtrarichedit-dot-documentformat-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-encryptionsettings-x29.md

latest4.1 KB
Original Source

RichEditDocumentServer.SaveDocument(Stream, DocumentFormat, EncryptionSettings) Method

Saves the document to a stream, specifying the document’s format and encryption options.

Namespace : DevExpress.XtraRichEdit

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
public void SaveDocument(
    Stream stream,
    DocumentFormat documentFormat,
    EncryptionSettings encryptionSettings
)
vb
Public Sub SaveDocument(
    stream As Stream,
    documentFormat As DocumentFormat,
    encryptionSettings As EncryptionSettings
)

Parameters

NameTypeDescription
streamStream

The stream used to output the document.

| | documentFormat | DocumentFormat |

Indicates the document format.

| | encryptionSettings | EncryptionSettings |

Document encryption options

|

Remarks

Use this SaveDocument method overload to encrypt a document with a password, as shown below:

csharp
EncryptionSettings encryptionSettings = new EncryptionSettings();
encryptionSettings.Type = EncryptionType.Strong;
encryptionSettings.Password = "12345";

server.SaveDocument(stream, documentFormat, encryptionSettings);
vb
Dim encryptionSettings As EncryptionSettings = New EncryptionSettings()
encryptionSettings.Type = EncryptionType.Strong
encryptionSettings.Password = "12345"
server.SaveDocument(stream, documentFormat, encryptionSettings)

The following code snippets (auto-collected from DevExpress Examples) contain references to the SaveDocument(Stream, DocumentFormat, EncryptionSettings) method.

Note

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.

office-file-api-in-web-api-app/CS/BusinessObjects/Helpers.cs#L37

csharp
else
        server.SaveDocument(resultStream, documentFormat, encryptionSettings);
}

office-file-api-ai-implementation/CS/BusinessObjects/Helpers.cs#L66

csharp
else
        server.SaveDocument(resultStream, documentFormat, encryptionSettings);
}

Implements

SaveDocument(Stream, DocumentFormat, EncryptionSettings)

See Also

How to: Open And Save Encrypted Files (GitHub)

RichEditDocumentServer Class

RichEditDocumentServer Members

DevExpress.XtraRichEdit Namespace