Document Protection Dialogs

The Document Protection and Unprotect Document dialogs allow end-users to protect a document by specifying a password and removing protection from a document if the password is known.



End-users can invoke these dialogs by clicking Protect Document or Unprotect Document on the Review ribbon tab. Refer to the How to: Create the RichEditControl with a Ribbon UI topic for details on how to provide the ribbon UI for the RichEditControl. Executing the ProtectDocumentCommand and UnprotectDocumentCommand commands invokes the dialogs as well.



To enforce document protection by setting the specified password in code or remove document protection without prompting or password entry, you can use the Document.Protect and Document.Unprotect methods.

To customize the default Start Enforcing Protection or Unprotect Document dialog (modify captions, set default dialog values, implement custom validation, etc.) or substitute it with completely new dialog, handle the RichEditControl.DocumentProtectionQueryNewPasswordFormShowing or RichEditControl.DocumentProtectionQueryPasswordFormShowing event. To get an example of the dialog replacement, refer to the How to: Customize the Search Form or How to: Customize the Hyperlink Form document.