Protect Workbook Dialog

The Protect Structure and Windows dialog allows end-users to protect the workbook using an optional password.

DXSpreadsheet_Dialogs_ProtectWorkbook

Add the Changes ribbon group to enable the Protect Workbook button, which invokes the target dialog. Refer to the Lesson 1 - Create a Simple Spreadsheet topic for details on how to provide the Ribbon UI for the SpreadsheetControl.

DXSpreadsheet_Dialogs_ProtectWorkbook_Ribbon

In a protected workbook, this button displays the "Unprotect Workbook" caption, which invokes a simple dialog that prompts for a password or unlocks the workbook if no password was set.

DXSpreadsheet_Dialogs_ProtectWorkbook_Unprotect

Checking the dialog check boxes enables the following types of protection:

  • Structure - prevents other users from moving, deleting, adding, hiding and renaming worksheets, as well as displaying hidden worksheets;
  • Windows - restricts changes to the window's position by freezing/unfreezing panes.
TIP

Use the IWorkbook.Protect method to protect a workbook's structure and windows in code, or the IWorkbook.Unprotect method to remove protection.