Skip to main content

Document Protection

  • 2 minutes to read

DXRichEdit introduces three types of protection that can be used to restrict a user's ability to modify a document - operation restrictions, document restrictions and document protection.

#Operation Restrictions

Documents can be protected by disabling specific functions of the Rich Editor. Some options allow preventing printing, copying or editing of documents. They can be specified via the RichEditControlOptionsBase.Behavior property accessible via the RichEditControl.Options.Behavior notation.

Commands such as Copy, Cut, Paste, Drag, Drop, Open, Save, Print, Zoom can be selectively disabled or hidden. Context menu can be disabled.

DXRichEdit_Operation_Restriction

#Document Restrictions

Character/paragraph formatting, inline images, hyperlinks and bookmarks, sections and tables functionality can be allowed or denied. If a document is loaded after certain restrictions are applied, the corresponding characteristics are set to default and corresponding objects are not created.

Document restrictions can be specified via the RichEditControlOptionsBase.DocumentCapabilities property accessible via the RichEditControl.Options.DocumentCapabilities notation.

The picture below shows how document appearance changes if a document is loaded when all document restrictions are in effect.

DXRichEdit_Document_Restriction

#Document Protection

Our document protection model is based on the RTF 1.9.1 specification (read-only password protection and protection exceptions sections) and is therefore compatible with the Microsoft® Word® document protection feature.

To enable/disable document protection, use ProtectDocumentCommand / UnprotectDocumentCommand commands.

If document protection is enabled, then no content in the document shall be editable except for the ranges with permissions. They can be modified by users with identities specified via the RangePermission.UserName

A RangePermission is a special type of bookmark used to control which users may edit a particular region of a document.

See Ranges with Permissions document for more information.