Worksheet 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 - Worksheet
- Document
A handle bound to a worksheet ID and opaque document generation.
Syntax
public class Worksheet
Members
Properties
| Property | Description |
|---|---|
| Charts | |
| Columns | |
| Drawings | |
| Id | |
| Names | |
| PivotTables | The destination-worksheet-scoped collection of operational pivot reports. |
| Protection | |
| Rows | |
| Tables | |
| Validation | |
| Viewport |
Methods
| Method | Description |
|---|---|
| AddSparklinesAsync | Adds sparklines from A1 dataRange/locationRange options in one undoable sheet-scoped transaction. |
| Cell | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| ClearSparklinesAsync | Removes sparklines in an A1 destination range, or all when omitted; source cells remain intact. |
| DuplicateAsync | Duplicates cells, formatting and objects with distinct table names and identities. |
| GetNameAsync | Performs an operation on this document without activating another worksheet. |
| GetSparklineGroupsAsync | Reads detached sparkline group definitions on this sheet without activating it. |
| GetTabColorAsync | Reads the persisted sRGB tab color, or null for the default tab appearance. |
| MoveAsync | Moves this worksheet within its group; index is zero-based. |
| Range | Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority. |
| RemoveAsync | Performs an operation on this document without activating another worksheet. |
| RenameAsync | Performs an operation on this document without activating another worksheet. |
| SetTabColorAsync | Sets the worksheet tab color in one undoable operation without changing cell or print formatting. |
| UpdateSparklineGroupAsync | Updates a group by stable ID; invalid patches or stale handles reject before mutation. |
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[]> CreateWorksheetReportAsync(ServerSheetControl control)
{
var book = control.Workbook;
var sheet = await book.Sheets.AtAsync(0);
await sheet.Cell("B8").SetValueAsync(120);
await sheet.Cell("B9").SetValueAsync(80);
await sheet.Cell("B10").SetFormulaAsync("=SUM(B8:B9)");
var worksheet = sheet;
return await control.SaveAsync(StreamType.PDF);
}