Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

Document.Protect(String, DocumentProtectionType) Method

Enforces document protection and sets the specified password.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

Declaration

void Protect(
    string password,
    DocumentProtectionType protectionType
)

Parameters

Name Type Description
password String

A password string.

protectionType DocumentProtectionType

One of the DocumentProtectionType enumeration values.

Remarks

Calling the Protect method restricts end-users from modifying the document. The password specified as the Protect parameter is used to unprotect the document in the UI using the Unprotect Document dialog.

The Document.IsDocumentProtected property indicates whether the document is protected.

To remove protection in code, call the Document.Unprotect method. It unprotects the document, ignoring the password.

The Protect method to not require user input. To allow end-users to create a password to protect the document, execute the ProtectDocumentCommand command instead.

View Example

See Also