# ProtectionOptions Class

> ProtectionOptions class in the TX Sheet Control .NET API: Protected-sheet editing permissions. Covers 1 constructor and 16 properties and a C# example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **Namespace:** `TXTextControl.TXSheetControl.Server`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Package:** `TXTextControl.TXSheetControl.Blazor` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Implements:** `System.IEquatable<TXTextControl.TXSheetControl.Server.ProtectionOptions>`
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > ProtectionOptions Class
- **1510 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/llms-full.txt

---

Protected-sheet editing permissions; passwords are supplied at runtime and never persisted as clear text.

### Syntax

```csharp
public class ProtectionOptions
```

Interfaces: `IEquatable<ProtectionOptions>`.

### Members

#### Constructors

| Constructor | Description |
|---|---|
| [Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/constructor/llms-full.txt) |  |

#### Properties

| Property | Description |
|---|---|
| [AllowDeleteColumns](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowdeletecolumns-property/llms-full.txt) |  |
| [AllowDeleteRows](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowdeleterows-property/llms-full.txt) |  |
| [AllowEditObjects](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/alloweditobjects-property/llms-full.txt) |  |
| [AllowEditScenarios](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/alloweditscenarios-property/llms-full.txt) | Permission retained for native Excel scenario editing. |
| [AllowFilter](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowfilter-property/llms-full.txt) |  |
| [AllowFormatCells](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowformatcells-property/llms-full.txt) |  |
| [AllowFormatColumns](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowformatcolumns-property/llms-full.txt) |  |
| [AllowFormatRows](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowformatrows-property/llms-full.txt) |  |
| [AllowInsertColumns](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowinsertcolumns-property/llms-full.txt) |  |
| [AllowInsertHyperlinks](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowinserthyperlinks-property/llms-full.txt) |  |
| [AllowInsertRows](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowinsertrows-property/llms-full.txt) |  |
| [AllowSelectLockedCells](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowselectlockedcells-property/llms-full.txt) |  |
| [AllowSelectUnlockedCells](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowselectunlockedcells-property/llms-full.txt) |  |
| [AllowSort](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowsort-property/llms-full.txt) |  |
| [AllowUsePivotTables](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowusepivottables-property/llms-full.txt) | Permission retained for native Excel PivotTable operations. |
| [Password](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/password-property/llms-full.txt) |  |

### Examples

Apply ProtectionOptions to a small working document, then return the exported bytes. The caller can save or download the result.

```csharp
using TXTextControl.TXSheetControl.Server;

async Task<byte[]> CreateProtectionOptionsReportAsync(ServerSheetControl control)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    await sheet.Cell("B8").SetValueAsync(120);
    await sheet.Cell("B9").SetValueAsync(80);
    await sheet.Cell("B10").SetFormulaAsync("=SUM(B8:B9)");
    await sheet.Cell("A1").SetTextAsync("October invoice");
    await sheet.Cell("A1").FormatAsync(new { fontFamily = "Liberation Sans", fontSize = 16, bold = true, textColor = "#ffffff", fillColor = "#163b63" });
    await sheet.Range("B8:B10").FormatAsync(new { numberFormatCode = "#,##0.00", fontFamily = "Liberation Sans", fontSize = 11 });

    var settings = new ProtectionOptions()
    {
        AllowSelectLockedCells = false,
        AllowSelectUnlockedCells = true,
        Password = "sample-edit-password"
    };

    await sheet.Protection.ProtectAsync(settings);
    return await control.SaveAsync(StreamType.SpreadsheetML);
}
```

### See Also

- [TXTextControl.TXSheetControl.Server Namespace](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/llms-full.txt)
- [Worksheet Protection](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/protection/llms-full.txt)

---

## In This Section

- [ProtectionOptions.AllowDeleteColumns Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowdeletecolumns-property/llms-full.txt): ProtectionOptions.AllowDeleteColumns property in the TX Sheet Control .NET API, with its syntax, its type bool? and a C# example.
- [ProtectionOptions.AllowDeleteRows Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowdeleterows-property/llms-full.txt): ProtectionOptions.AllowDeleteRows property in the TX Sheet Control .NET API, with its syntax, its type bool? and a C# example.
- [ProtectionOptions.AllowEditObjects Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/alloweditobjects-property/llms-full.txt): ProtectionOptions.AllowEditObjects property in the TX Sheet Control .NET API, with its syntax, its type bool? and a C# example.
- [ProtectionOptions.AllowEditScenarios Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/alloweditscenarios-property/llms-full.txt): ProtectionOptions.AllowEditScenarios property in the TX Sheet Control .NET API: Permission retained for native Excel scenario editing.
- [ProtectionOptions.AllowFilter Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowfilter-property/llms-full.txt): ProtectionOptions.AllowFilter property in the TX Sheet Control .NET API, with its syntax, its type bool? and a C# example.
- [ProtectionOptions.AllowFormatCells Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowformatcells-property/llms-full.txt): ProtectionOptions.AllowFormatCells property in the TX Sheet Control .NET API, with its syntax, its type bool? and a C# example.
- [ProtectionOptions.AllowFormatColumns Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowformatcolumns-property/llms-full.txt): ProtectionOptions.AllowFormatColumns property in the TX Sheet Control .NET API, with its syntax, its type bool? and a C# example.
- [ProtectionOptions.AllowFormatRows Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowformatrows-property/llms-full.txt): ProtectionOptions.AllowFormatRows property in the TX Sheet Control .NET API, with its syntax, its type bool? and a C# example.
- [ProtectionOptions.AllowInsertColumns Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowinsertcolumns-property/llms-full.txt): ProtectionOptions.AllowInsertColumns property in the TX Sheet Control .NET API, with its syntax, its type bool? and a C# example.
- [ProtectionOptions.AllowInsertHyperlinks Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowinserthyperlinks-property/llms-full.txt): ProtectionOptions.AllowInsertHyperlinks property in the TX Sheet Control .NET API, with its type bool? and a C# example.
- [ProtectionOptions.AllowInsertRows Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowinsertrows-property/llms-full.txt): ProtectionOptions.AllowInsertRows property in the TX Sheet Control .NET API, with its syntax, its type bool? and a C# example.
- [ProtectionOptions.AllowSelectLockedCells Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowselectlockedcells-property/llms-full.txt): ProtectionOptions.AllowSelectLockedCells property in the TX Sheet Control .NET API, with its type bool? and a C# example.
- [ProtectionOptions.AllowSelectUnlockedCells Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowselectunlockedcells-property/llms-full.txt): ProtectionOptions.AllowSelectUnlockedCells property in the TX Sheet Control .NET API, with its type bool? and a C# example.
- [ProtectionOptions.AllowSort Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowsort-property/llms-full.txt): ProtectionOptions.AllowSort property in the TX Sheet Control .NET API, with its syntax, its type bool? and a C# example.
- [ProtectionOptions.AllowUsePivotTables Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/allowusepivottables-property/llms-full.txt): ProtectionOptions.AllowUsePivotTables property in the TX Sheet Control .NET API: Permission retained for native Excel PivotTable operations.
- [ProtectionOptions Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/constructor/llms-full.txt): ProtectionOptions constructor in the TX Sheet Control .NET API, with its syntax, a C# example and remarks on awaiting tasks and handles.
- [ProtectionOptions.Password Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/password-property/llms-full.txt): ProtectionOptions.Password property in the TX Sheet Control .NET API, with its syntax, its type string? and a C# example.

---

## Nearby

- **Previous:** [Protection.UnprotectAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protection/unprotectasync-method/llms-full.txt)
- **Next:** [ProtectionOptions Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/protectionoptions/constructor/llms-full.txt)
