Workbook 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
Asynchronous workbook editing, formatting, calculation, loading and saving.
Syntax
public class Workbook
Members
Properties
| Property | Description |
|---|---|
| Analytics | Workbook-wide data discovery, profiling, relationships and queries. |
| Calculation | |
| CellTypes | |
| Dashboards | First-class dashboard views persisted in TXWB documents. |
| Events | |
| History | |
| Names | |
| PivotTables | The workbook-wide collection of operational pivot reports. |
| Search | |
| Sheets |
Methods
| Method | Description |
|---|---|
| AddConditionalRuleAsync | Validates and adds an active worksheet conditional rule; returns its stable identifier as a JSON string. |
| ApplyCellStyleAsync | Applies an existing workbook style identifier to an active worksheet A1 range, respecting sheet protection. |
| BatchAsync | Collects synchronous workbook operations and applies them as one atomic undoable transaction. |
| ClearFiltersAsync | Clears active worksheet filter criteria while retaining its filter range. |
| ConsolidateAsync | Aggregates A1 source ranges using the supplied function/destination options; occupied destinations require explicit overwrite permission. |
| CreateCellStyleAsync | Creates a workbook-wide named style from formatting and optional included-property flags; returns its identifier as a JSON string. |
| CreateMailMergeTemplateAsync | Performs an operation on this document without activating another worksheet. |
| DeleteConditionalRuleAsync | Removes an active worksheet conditional rule by stable identifier and records an undoable edit. |
| GetActiveViewAsync | Returns the sole active worksheet or dashboard viewport. |
| GetAutoFilterAsync | Returns a detached active worksheet filter definition, or JSON null when no filter exists. |
| GetInfoAsync | Performs an operation on this document without activating another worksheet. |
| GetMailMergeAsync | |
| GetUserNameAsync | Reads the runtime comment author independently of the selected worksheet. |
| ListConditionalRulesAsync | Returns detached active worksheet conditional rules, optionally restricted to an intersecting A1 range. |
| ListNamedStylesAsync | Returns detached named cell styles shared by every worksheet in this workbook. |
| LoadAsync | Loads a binary document with the same reusable options as the owning control. |
| LoadTextAsync | Loads CSV, XML or JSON text with flat configuration; filename strings continue to use LoadAsync. |
| MergeAsync | Merges application data into an isolated document snapshot before replacing the current workbook. |
| PreviewConsolidateAsync | Plans aggregation from A1 source ranges into an active worksheet destination without editing cells; reports occupied output cells. |
| PreviewRemoveDuplicatesAsync | Finds duplicate rows in an active worksheet A1 range without editing cells; returns counts and a detached write plan. |
| PreviewTextToColumnsAsync | Plans a text split without editing cells. The JSON result includes destination, dimensions, writes and overwriteCount. |
| RecalculateAsync | Performs an operation on this document without activating another worksheet. |
| RemoveDuplicatesAsync | Removes duplicate rows using the requested columns/header options; returns counts and records an undoable edit. |
| SaveAsync | Saves a detached binary document snapshot; export metadata never changes the live workbook. |
| SaveTextAsync | Saves CSV, XML or JSON text through the owning control, omitting a generated CSV BOM while preserving save events and UTF-8 byte limits. |
| SetActiveViewAsync | Selects an existing worksheet or dashboard. Does not change worksheet selection or filters. |
| SetAutoFilterAsync | Configures the active worksheet filter from a portable range/criteria object; null removes the filter. |
| SetMailMergeAsync | |
| SetThemeAsync | Replaces workbook-wide theme colors with the validated ordered color palette; updates dependent styles and charts. |
| SetUserNameAsync | Changes the current comment author; this string is not saved as a workbook setting. |
| SortRangeAsync | Sorts an A1 range on the active worksheet using validated sort keys; preserves row relationships and records one undo operation. |
| TextToColumnsAsync | Splits text in an active worksheet A1 range. Options define delimiters, destination and explicit overwrite permission; returns the applied plan. |
| UpdateCellStyleAsync | Updates a workbook-wide named style; returns its stable identifier as a JSON string and refreshes affected cells. |
| UpdateConditionalRuleAsync | Applies a validated partial definition to an existing active worksheet conditional rule; unknown identifiers fail. |
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[]> CreateWorkbookReportAsync(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 workbook = book;
return await control.SaveAsync(StreamType.PDF);
}