TX Sheet Control

Table Class

Class
Namespace
TXTextControl.TXSheetControl.Server
Package
TXTextControl.TXSheetControl.Server from the private NuGet feed or the supplied NuGet folder
Assembly
TXTextControl.TXSheetControl.Api.dll
Install
dotnet add package TXTextControl.TXSheetControl.Server .NET 10 and later.
Also in
TXTextControl.TXSheetControl.Blazor as TXTextControl.TXSheetControl.Api.dll
Inherits
  1. DocumentObject
  2. Table

A table identity bound to one worksheet generation; access fails after deletion or document replacement.

Syntax

public class Table

Members

Properties

PropertyDescription
Id

Methods

MethodDescription
DeleteColumnsAsyncDeletes count table columns at a zero-based column index in one undoable operation. Throws for invalid bounds, protection, split ranges or worksheet overflow. Retained column identities are preserved; deleting all columns removes the table.
DeleteRowsAsyncDeletes count table rows at a zero-based data-row index in one undoable operation. Throws for invalid bounds, protection, split ranges or worksheet overflow. Headers and totals are retained; deleting all data rows leaves one blank row.
GetSnapshotAsyncReads detached columns, range, style, totals and expansion settings.
InsertColumnsAsyncInserts count table columns at a zero-based column index in one undoable operation. Throws for invalid bounds, protection, split ranges or worksheet overflow. Retained column identities are preserved; deleting all columns removes the table.
InsertRowsAsyncInserts count table rows at a zero-based data-row index in one undoable operation. Throws for invalid bounds, protection, split ranges or worksheet overflow. Headers and totals are retained; deleting all data rows leaves one blank row.
RemoveAsyncConverts the table to ordinary cells, retaining content and existing formatting.
RenameAsyncRenames the table and updates structured references throughout the workbook.
ResizeAsyncResizes to a non-overlapping range while retaining its named columns.
SetColumnAsyncUpdates a named column's calculated formula or totals calculation.
UpdateAsyncChanges table settings without replacing identity; affected cells participate in the same transaction.

Examples

Build a small report using this document API and return its PDF bytes. Pass a live control with a fresh workbook; the caller owns its lifetime.

using TXTextControl.TXSheetControl.Server;

async Task<byte[]> CreateTableReportAsync(ServerSheetControl control)
{
    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 table.SetColumnAsync("Amount", new TableColumnOptions { Formula = "=[@Quantity]*[@UnitPrice]" });
    await sheet.Range("C8:D9").FormatAsync(new { numberFormatCode = "#,##0.00", fontFamily = "Liberation Sans", fontSize = 11 });
    return await control.SaveAsync(StreamType.PDF);
}

See Also