Class SheetProtection
Represents the protection of a sheet
Inherited Members
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class SheetProtection
Constructors
SheetProtection()
Initializes a new SheetProtection for the supplied workbook data.
Declaration
public SheetProtection()
Properties
DeleteColumns
Gets or sets whether deleting columns is allowed when the sheet is protected.
Declaration
public bool DeleteColumns { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
DeleteRows
Gets or sets whether deleting rows is allowed when the sheet is protected.
Declaration
public bool DeleteRows { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
EditObjects
Gets or sets whether editing of objects is allowed when the sheet is protected
Declaration
public bool EditObjects { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
EditScenarios
Gets or sets whether the editing of scenarios is allowed when the sheet is protected.
Declaration
public bool EditScenarios { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
FormatCells
Gets or sets whether formatting cells is allowed when the sheet is protected.
Declaration
public bool FormatCells { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
FormatColumns
Gets or sets whether formatting columns is allowed when the sheet is protected.
Declaration
public bool FormatColumns { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
FormatRows
Gets or sets whether formatting rows is allowed when the sheet is protected.
Declaration
public bool FormatRows { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
InsertColumns
Gets or sets whether inserting columns is allowed when the sheet is protected.
Declaration
public bool InsertColumns { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
InsertHyperlinks
Gets or sets whether inserting hyperlinks is allowed when the sheet is protected
Declaration
public bool InsertHyperlinks { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
InsertRows
Gets or sets whether inserting rows is allowed when the sheet is protected.
Declaration
public bool InsertRows { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
PasswordHash
Get or set the hash of the password of the sheet protection
Declaration
public ushort PasswordHash { get; set; }
Property Value
| Type | Description |
|---|---|
| ushort |
Protected
Gets or sets whether to protect worksheet and contents of locked cells.
Declaration
public bool Protected { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
SelectLockedCells
Gets or sets whether selection of locked cells is allowed when the sheet is protected.
Declaration
public bool SelectLockedCells { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
SelectUnlockedCells
Gets or sets whether selection of unlocked cells is allowed when the sheet is protected
Declaration
public bool SelectUnlockedCells { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Sort
Gets or sets whether sorting is allowed when the sheet is protected
Declaration
public bool Sort { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
UseAutoFilter
Gets or sets whether the use of AutoFilters is allowed when the sheet is protected.
Declaration
public bool UseAutoFilter { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
UsePivotTables
Gets or sets whether the use of PivotTables and Pivot Charts are allowed when the sheet is protected.
Declaration
public bool UsePivotTables { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
Protect()
Exposes the protect associated with SheetProtection.
Declaration
public void Protect()
Protect(string)
Activates protection and sets the protection password hash.
Declaration
public void Protect(string password)
Parameters
| Type | Name | Description |
|---|---|---|
| string | password | Password used for protection. Null or empty clears the hash. |
SetPasswordHash(string)
Set the password hash from a given password.
Declaration
public void SetPasswordHash(string password)
Parameters
| Type | Name | Description |
|---|---|---|
| string | password | The password to hash |
Unprotect(string)
Removes protection from the worksheet. If a password is provided, it must match the stored password hash.
Declaration
public void Unprotect(string password = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | password | The password to verify. Can be null or empty if no password was set. |