[]
Represents the various types of protection options available for a worksheet.
Use this interface to configure which operations remain available on a protected worksheet, such as inserting or deleting rows and columns, filtering, sorting, or editing scenarios. The setting action will take effect only if the worksheet is under protection.
public interface IProtectionSettings
Public Interface IProtectionSettings
worksheet.Protection = true;
IProtectionSettings protectionSettings = worksheet.ProtectionSettings;
protectionSettings.AllowDeletingColumns = true;
protectionSettings.AllowDeletingRows = true;
| Name | Description |
|---|---|
| AllowDeletingColumns | Gets or sets whether the deletion of columns is allowed on a protected worksheet. This setting is meaningful only when worksheet protection is enabled. |
| AllowDeletingRows | Gets or sets whether the deletion of rows is allowed on a protected worksheet. This setting is meaningful only when worksheet protection is enabled. |
| AllowEditingScenarios | Gets or sets whether the user is allowed to edit scenarios on a protected worksheet. The default value is false. |
| AllowFiltering | Gets or sets whether the user is allowed to use an AutoFilter that was created before the sheet was protected. This property indicates whether filtering remains available after worksheet protection is enabled. |
| AllowFormattingCells | Gets or sets whether the formatting of cells is allowed on a protected worksheet. This setting is meaningful only when worksheet protection is enabled. |
| AllowFormattingColumns | Gets or sets whether the formatting of columns is allowed on a protected worksheet. This setting is meaningful only when worksheet protection is enabled. |
| AllowFormattingRows | Gets or sets whether the formatting of rows is allowed on a protected worksheet. |
| AllowInsertingColumns | Gets or sets whether the insertion of columns is allowed on a protected worksheet. This property determines whether users can insert columns while worksheet protection is enabled. |
| AllowInsertingHyperlinks | Gets or sets whether the insertion of hyperlinks is allowed on a protected worksheet. This property applies when worksheet protection is enabled. |
| AllowInsertingRows | Gets or sets whether the insertion of rows is allowed on a protected worksheet. This property determines whether users can insert rows while worksheet protection is enabled. |
| AllowSorting | Gets or sets whether the sorting option is allowed on a protected worksheet. This property indicates whether users can sort ranges when worksheet protection is enabled. |
| AllowUsingObjects | Gets or sets whether the user is allowed to select and edit drawing objects on a protected worksheet. Drawing objects include shapes, charts, pictures, text boxes, and controls. This setting is meaningful only when worksheet protection is enabled. |
| AllowUsingPivotTables | Gets or sets whether the user is allowed to use pivot tables on a protected worksheet. This property indicates whether users can work with pivot tables when worksheet protection is enabled. |
| Name | Description |
|---|---|
| FromJson(string) | Loads worksheet protection settings from a JSON string into this object. Use this method to update the current IProtectionSettings instance from a JSON string produced by ToJson(). The configured settings take effect only when the worksheet is protected. |
| ToJson() | Serializes the current worksheet protection settings to a JSON string. Use this method to serialize the current IProtectionSettings values so that they can be reused with FromJson(string). The serialized content represents worksheet protection options. |