public void Protect( Nullable<bool> allowDeletingColumns, Nullable<bool> allowDeletingRows, Nullable<bool> allowEditObjects, Nullable<bool> allowEditScenarios, Nullable<bool> allowFiltering, Nullable<bool> allowFormattingCells, Nullable<bool> allowFormattingColumns, Nullable<bool> allowFormattingRows, Nullable<bool> allowInsertingColumns, Nullable<bool> allowInsertingHyperlinks, Nullable<bool> allowInsertingRows, Nullable<bool> allowSorting, Nullable<bool> allowUsingPivotTables )
When a Worksheet is protected without a password, the end user may unprotect the Worksheet in Excel without having to supply a password. To programatically unprotect a Worksheet, one may use the Unprotect method.
The optional parameters are used to update the property values of the WorksheetProtection instance from this Worksheet's Protection property. If the parameter is null, the current value of the associated property will be retained; otherwise the property will be updated with the specified value. For example, if the AllowDeletingColumns is currently true and the allowDeletingColumns is null, then the property will continue to be true but if the allowDeletingColumns is false the AllowDeletingColumns will be changed to false.
When one protects a Worksheet in Excel, the UI allows one to choose which cells may be selected. To affect this state one would change the SelectionMode property before or after protecting the Worksheet.
Note: If IsProtected is already true, the method will be ignored.
Target Platforms: Android 4.4+, iOS 8+
Development Environments: Visual Studio 2015+, Visual Studio for Mac Preview, Xamarin for Visual Studio 4.2+
Worksheet Class
Worksheet Members
HasProtectionPassword
IsProtected
Protection Property
WorksheetProtection Class
Unprotect()