TX Sheet Control

ServerSheetControl Class

Class
Namespace
TXTextControl.TXSheetControl.Server
Package
TXTextControl.TXSheetControl.Server from the private NuGet feed or the supplied NuGet folder
Assembly
TXTextControl.TXSheetControl.Server.dll
Install
dotnet add package TXTextControl.TXSheetControl.Server .NET 10 and later.
Implements
IAsyncDisposable, ISheetControl

Owns an independent spreadsheet document with asynchronous editing, calculation, loading and saving.

Syntax

public class ServerSheetControl

Interfaces: IAsyncDisposable.

Members

Constructors

ConstructorDescription
ConstructorCreates a control that owns an independent workbook.

Properties

PropertyDescription
Events
LastPdfPageCount
LicenseInfoRead-only signed customer information and current trial validity, including after expiry.
Workbook

Methods

MethodDescription
BatchAsyncCollects synchronous workbook operations and applies them as one atomic undoable transaction.
CreateSessionCreates an independent document with its own workbook contents and edit history.
DisposeAsyncReleases this document and its resources. Dispose documents created from it first.
GetFontCatalogAsyncScans the deployed Fonts folder and returns the catalog used by PDF rendering.
GetFontFileAsyncReads a catalogued face for HTTP hosting, using the same bytes as PDF export.
GetPrintLayoutAsyncPerforms an operation on this document without activating another worksheet.
GetUserNameAsyncReads the author name used for new comments.
GetWarningsAsyncPerforms an operation on this document without activating another worksheet.
GetXlsxWarningsAsyncPerforms an operation on this document without activating another worksheet.
LoadAsyncLoads workbook or UTF-8 CSV/XML/JSON tabular bytes atomically. Raises Loading once and Loaded only after replacement succeeds.
LoadTextAsyncLoads CSV, tabular XML or tabular JSON text. Data belongs in this first argument; options contain configuration only.
MergeAsyncMerges application data into an isolated document snapshot before replacing the current workbook.
RefreshFontsAsyncRe-reads font files, including replacements whose timestamps were preserved.
SaveAsyncSaves an isolated revision to bytes. Saving is cancellable; Saved follows successful byte generation.
SaveTextAsyncSaves one worksheet's CSV, tabular XML or tabular JSON as a string, with the same snapshot, limits and events as SaveAsync.
SetPrintContextAsyncPerforms an operation on this document without activating another worksheet.
SetUserNameAsyncSets 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?[][]
    {
        ["Description", "Quantity", "UnitPrice", "Amount"],
        ["Consulting", 3, 120, 360],
        ["Training", 2, 90, 180]
    });

    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);
}

See Also