[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Collapse]Office File API
  Demo Application
  Redistribution and Deployment
 [Collapse]Spreadsheet Document API
   Product Structure
   Getting Started
  [Expand]Spreadsheet Document
   Supported Formats
  [Expand]Cell Basics
  [Expand]Formulas
   Defined Names
   Data Binding
  [Expand]Pivot Tables
  [Expand]Charts and Graphics
  [Expand]Mail Merge
  [Collapse]Examples
   [Expand]Files
   [Expand]Workbooks
   [Expand]Worksheets
   [Expand]Rows and Columns
   [Expand]Cells
   [Expand]Formulas
   [Expand]Import and Export Data
   [Expand]Data Binding
    Sorting
   [Expand]Mail Merge
    Search
   [Expand]Shapes
   [Expand]Charts
   [Expand]Sparklines
   [Expand]Formatting Cells
   [Expand]Conditional Formatting
   [Expand]Group Data
   [Expand]Filter Data
   [Expand]Tables
   [Expand]Pivot Tables
   [Expand]Printing
   [Expand]Pictures
   [Collapse]Protection
     How to: Protect a Workbook
     How to: Protect a Worksheet
     How to: Protect Specific Worksheet Ranges
 [Expand]Word Processing Document API
 [Expand]PDF Document API
 [Expand]Excel Export Library
 [Expand]Snap Report API
 [Expand]Zip Compression and Archive API
 [Expand]Barcode Generation API
 [Expand]Unit Conversion API
 [Expand]API Reference
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Protect a Worksheet

You can protect a worksheet by locking cells, so that end-users can only perform a specific (restricted) set of actions specified by the WorksheetProtectionPermissions enumeration member.

By default, all cells in a worksheet have the Protection.Locked attribute set to true. When protection is applied to a worksheet, these cells become read-only. Cells with the Protection.Locked attribute set to false are not protected when worksheet protection is applied, so that the end-users can edit or delete their content.

To apply worksheet protection, use the Worksheet.Protect method, as illustrated in the example below. By default, when you pass the WorksheetProtectionPermissions.Default parameter to the Protect method, a protected worksheet is locked so that an end-user can only select cells.

Expanded Unprotect a worksheet

To remove protection, use the Worksheet.Unprotect method.

Expanded See Also

Is this topic helpful?​​​​​​​