# ServerSheetControl.CreateSession Method

> ServerSheetControl.CreateSession method in the TX Sheet Control .NET API: Creates an independent document with its own workbook contents and edit history.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Namespace:** `TXTextControl.TXSheetControl.Server`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Server.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > ServerSheetControl > ServerSheetControl.CreateSession Method
- **732 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/createsession-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/createsession-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/createsession-method/llms-full.txt

---

Creates an independent document with its own workbook contents and edit history.

### Syntax

```csharp
public ServerSheetControl CreateSession(ServerSheetControlOptions? options = null)
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `options` | `ServerSheetControlOptions?` | Yes | Optional document defaults; omission inherits the owner's font source and workbook settings. |

### Return Value

`ServerSheetControl`. A new document control. Dispose it before the control that created it.

### Exceptions

- ObjectDisposedException: The owner has been disposed.

### Examples

Create and format a complete invoice before using this processing API. Return document bytes, operation metadata or notifications to the application; dispose owned controls after processing.

```csharp
using TXTextControl.TXSheetControl.Server;

async Task<byte[]> CreateInvoiceCreateSessionAsync(ServerSheetControl control)
{
    await using var session = control.CreateSession();
    var sheet = await session.Workbook.Sheets.AtAsync(0);
    await sheet.Cell("A1").SetTextAsync("Independent customer invoice");
    await sheet.Cell("A1").FormatAsync(new { fontFamily = "Liberation Sans", fontSize = 16, bold = true, textColor = "#ffffff", fillColor = "#163b63" });
    return await session.SaveAsync(StreamType.PDF);
}
```

### Remarks

Use the member with an instance or settings object from the documented package. Await task-returning operations. Document-bound handles must be resolved again after loading or deleting their owner.

### See Also

- [ServerSheetControl Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/llms-full.txt)
- [Workbooks and Worksheets](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/workbooks/llms-full.txt)
- [ServerSheetControlOptions Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontroloptions/llms-full.txt)

---

## Nearby

- **Previous:** [ServerSheetControl.BatchAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/batchasync-method/llms-full.txt)
- **Next:** [ServerSheetControl.DisposeAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/disposeasync-method/llms-full.txt)
