Skip to main content

Protect Sheet Dialog

The Protect Sheet dialog allows end-users to protect worksheet elements, using an optional password. Worksheet protection locks the cells so that you can only perform a specific (restricted) set of actions.

By default, all cells in the worksheet are locked. When protection is applied to the worksheet, these cells become read-only. However, you can specify certain actions which can be performed with the locked cells in a protected worksheet.

Protect_Sheet

To invoke this dialog, on the Review tab, in the Changes group, click Protect Sheet.

SpreadsheetControl_Review_Changes_Worksheet

In a protected sheet, this button displays the “Unprotect Sheet“ caption, which invokes a simple dialog that prompts for a password or unlocks the sheet if an empty password was set.

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

To programmatically protect a worksheet, use the Worksheet.Protect method. To remove protection, use the Worksheet.Unprotect method.

Note

The Select locked cells and Select unlocked cells options (the WorksheetProtectionPermissions.SelectLockedCells and the WorksheetProtectionPermissions.SelectUnlockedCells parameters) do not affect the SpreadsheetControl behavior. The cells are always selectable.