User Permissions Dialog

  • 2 minutes to read

In a protected worksheet, all cells are locked. However, the end-user can unlock certain ranges for users who provide the correct password. The end-user can also specify user accounts and groups who can edit specific ranges without a password. The Allow Users to Edit Ranges dialog is implemented to accomplish these tasks.

Protect_Allow_Users_To_Edit_Ranges

For example, an end-user can click the New... button to display a dialog to specify the worksheet range and password, as illustrated below.

Protect_New_Range

The Permissions... button allows an end-user to specify Active Directory users and groups.

Protect_Permission_for_Range1

After all required permissions and password-protected ranges are specified, the end-user should protect the worksheet to activate permissions.

To invoke the dialog, on the Review tab, in the Changes group, click Allow Users to Edit Ranges.

SpreadsheetControl_Review_Changes_UserPermissions

For an example on how to provide a Ribbon UI for the SpreadsheetControl, refer to the Getting Started topic.

To programmatically create password-protected ranges, create an item of the Worksheet.ProtectedRanges collection and use the ProtectedRange.SetPassword method to set a password. For user-level security, create a permission (the EditRangePermission object) for each user or group, transform a list of permissions to a security descriptor by using the ProtectedRange.CreateSecurityDescriptor method and specify the security descriptor for the range by using the ProtectedRange.SecurityDescriptor method.