.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.v20.1.Core.dll

Declaration

void Protect(
    string password,
    DocumentProtectionType protectionType
)
Sub Protect(
    password As String,
    protectionType As DocumentProtectionType
)

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.

TIP

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E3017.

See Also