ServerSheetControl Class
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Server
- Assembly
TXTextControl.TXSheetControl. Server. dll
- Install
dotnet add package TXTextControl..NET 10 and later.TXSheetControl. Server
- Implements
- IAsync
Disposable , ISheetControl
Owns an independent spreadsheet document with asynchronous editing, calculation, loading and saving.
Syntax
public class ServerSheetControl
Interfaces: IAsyncDisposable.
Members
Constructors
| Constructor | Description |
|---|---|
| Constructor | Creates a control that owns an independent workbook. |
Properties
| Property | Description |
|---|---|
| Events | |
| LastPdfPageCount | |
| LicenseInfo | Read-only signed customer information and current trial validity, including after expiry. |
| Workbook |
Methods
| Method | Description |
|---|---|
| BatchAsync | Collects synchronous workbook operations and applies them as one atomic undoable transaction. |
| CreateSession | Creates an independent document with its own workbook contents and edit history. |
| DisposeAsync | Releases this document and its resources. Dispose documents created from it first. |
| GetFontCatalogAsync | Scans the deployed Fonts folder and returns the catalog used by PDF rendering. |
| GetFontFileAsync | Reads a catalogued face for HTTP hosting, using the same bytes as PDF export. |
| GetPrintLayoutAsync | Performs an operation on this document without activating another worksheet. |
| GetUserNameAsync | Reads the author name used for new comments. |
| GetWarningsAsync | Performs an operation on this document without activating another worksheet. |
| GetXlsxWarningsAsync | Performs an operation on this document without activating another worksheet. |
| LoadAsync | Loads workbook or UTF-8 CSV/XML/JSON tabular bytes atomically. Raises Loading once and Loaded only after replacement succeeds. |
| LoadTextAsync | Loads CSV, tabular XML or tabular JSON text. Data belongs in this first argument; options contain configuration only. |
| MergeAsync | Merges application data into an isolated document snapshot before replacing the current workbook. |
| RefreshFontsAsync | Re-reads font files, including replacements whose timestamps were preserved. |
| SaveAsync | Saves an isolated revision to bytes. Saving is cancellable; Saved follows successful byte generation. |
| SaveTextAsync | Saves one worksheet's CSV, tabular XML or tabular JSON as a string, with the same snapshot, limits and events as SaveAsync. |
| SetPrintContextAsync | Performs an operation on this document without activating another worksheet. |
| SetUserNameAsync | Sets the current comment author; a simple userName string is sufficient. |
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.
using TXTextControl.TXSheetControl.Server;
async Task<byte[]> CreateInvoiceReportAsync()
{
await using var control = new ServerSheetControl();
var book = control.Workbook;
var sheet = await book.Sheets.AtAsync(0);
await sheet.Range("A7:D9").SetValuesAsync(new object?[][]
{
[],
[],
[]
});
var table = await sheet.Tables.AddAsync("InvoiceLines", "A7:D9", new TableOptions { Style = "TableStyleMedium2", ShowRowStripes = true });
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("C8:D9").FormatAsync(new { numberFormatCode = "#,##0.00", fontFamily = "Liberation Sans", fontSize = 11 });
return await control.SaveAsync(StreamType.PDF);
}