Skip to main content

Document Protection

  • 3 minutes to read

Overview

The document protection sets rules on the editing of particular documents. Users cannot modify a protected document. However, this document type may include range permissions that authorize a user (or a user group) to edit a specific text area. You can apply protection and range permissions to a document using Microsoft Word or Rich Edit Document Server.

Users can use the ASPxRichEdit to open and view protected documents. The control allows you to identify the current user to enable ranges permitted for the specified user or group. Editable ranges can be enclosed in brackets and highlighted, as illustrated in the following image:

ASPxRichEdit_DocumentProtection

Note

Users and groups range permissions are not compatible with Microsoft Word’s Editing Restrictions. Only the predefined groups are saved in RTF format; group names are not saved in DOC format.

Authentication Settings

A protected document may include range permissions granted to a unique user or a user group. These permissions require a user’s credentials to authorize editing of ranges. The ASPxRichEdit control includes the ASPxRichEditSettings.Authentication property that allows you to identify a current user’s credentials and enable separate text areas (or entire document) for editing. This property provides access to the ASPxRichEditAuthenticationSettings object containing the following user’s credentials:

The control authorizes editing of range if one of the user’s credentials meets the range permission’s requirements.

Note, that if a protected document includes a range permitted for a user group named Everyone, every user can edit this text area even if the ASPxRichEditSettings.Authentication settings are not defined.

The code snippet below demonstrates an ASPxRichEdit class instance with the specified authentication settings:

<dx:ASPxRichEdit ID="ASPxRichEdit1" runat="server" WorkDirectory="~\App_Data\WorkDirectory" >
    <Settings>
        <Authentication UserName="User1" Group="Editors"/>
    </Settings>
</dx:ASPxRichEdit>

Appearance Settings

The ASPxRichEdit control allows you to highlight text ranges that the current user can edit in the protected document. The ASPxRichEditSettings.RangePermissions property stores the ASPxRichEditRangePermissionSettings class’s instance that allows you to specify the following settings:

The following code snippet demonstrates an ASPxRichEdit class instance with the specified range permissions options:

<dx:ASPxRichEdit ID="ASPxRichEdit1" runat="server" WorkDirectory="~\App_Data\WorkDirectory" >
    <Settings>
        <Authentication UserName="User1" Group="Editors"/>
        <RangePermissions Visibility="Visible" HighlightBracketsColor="YellowGreen" HighlightColor="OrangeRed"/>
    </Settings>
</dx:ASPxRichEdit>
See Also