Skip to main content
.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.v22.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

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Protect(String, DocumentProtectionType) 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.

See Also