.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Document.Protect(String, DocumentProtectionType) Method

Enforces document protection and sets the specified password.

Namespace: DevExpress.XtraRichEdit.API.Native

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


void Protect(
    string password,
    DocumentProtectionType protectionType


Name Type Description
password String

A password string.

protectionType DocumentProtectionType

One of the DocumentProtectionType enumeration values.


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