Table Class
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Server
- Assembly
TXTextControl.TXSheetControl. Api. dll
- Install
dotnet add package TXTextControl..NET 10 and later.TXSheetControl. Server
- Also in
TXTextControl.asTXSheetControl. Blazor TXTextControl.TXSheetControl. Api. dll
- Inherits
- Document
Object - Table
- Document
A table identity bound to one worksheet generation; access fails after deletion or document replacement.
Syntax
public class Table
Members
Properties
| Property | Description |
|---|---|
| Id |
Methods
| Method | Description |
|---|---|
| DeleteColumnsAsync | Deletes 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. |
| DeleteRowsAsync | Deletes 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. |
| GetSnapshotAsync | Reads detached columns, range, style, totals and expansion settings. |
| InsertColumnsAsync | Inserts 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. |
| InsertRowsAsync | Inserts 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. |
| RemoveAsync | Converts the table to ordinary cells, retaining content and existing formatting. |
| RenameAsync | Renames the table and updates structured references throughout the workbook. |
| ResizeAsync | Resizes to a non-overlapping range while retaining its named columns. |
| SetColumnAsync | Updates a named column's calculated formula or totals calculation. |
| UpdateAsync | Changes 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?[][]
{
[],
[],
[]
});
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);
}