TX Sheet Control

Workbook 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

Asynchronous workbook editing, formatting, calculation, loading and saving.

Syntax

public class Workbook

Members

Properties

PropertyDescription
AnalyticsWorkbook-wide data discovery, profiling, relationships and queries.
Calculation
CellTypes
DashboardsFirst-class dashboard views persisted in TXWB documents.
Events
History
Names
PivotTablesThe workbook-wide collection of operational pivot reports.
Search
Sheets

Methods

MethodDescription
AddConditionalRuleAsyncValidates and adds an active worksheet conditional rule; returns its stable identifier as a JSON string.
ApplyCellStyleAsyncApplies an existing workbook style identifier to an active worksheet A1 range, respecting sheet protection.
BatchAsyncCollects synchronous workbook operations and applies them as one atomic undoable transaction.
ClearFiltersAsyncClears active worksheet filter criteria while retaining its filter range.
ConsolidateAsyncAggregates A1 source ranges using the supplied function/destination options; occupied destinations require explicit overwrite permission.
CreateCellStyleAsyncCreates a workbook-wide named style from formatting and optional included-property flags; returns its identifier as a JSON string.
CreateMailMergeTemplateAsyncPerforms an operation on this document without activating another worksheet.
DeleteConditionalRuleAsyncRemoves an active worksheet conditional rule by stable identifier and records an undoable edit.
GetActiveViewAsyncReturns the sole active worksheet or dashboard viewport.
GetAutoFilterAsyncReturns a detached active worksheet filter definition, or JSON null when no filter exists.
GetInfoAsyncPerforms an operation on this document without activating another worksheet.
GetMailMergeAsync
GetUserNameAsyncReads the runtime comment author independently of the selected worksheet.
ListConditionalRulesAsyncReturns detached active worksheet conditional rules, optionally restricted to an intersecting A1 range.
ListNamedStylesAsyncReturns detached named cell styles shared by every worksheet in this workbook.
LoadAsyncLoads a binary document with the same reusable options as the owning control.
LoadTextAsyncLoads CSV, XML or JSON text with flat configuration; filename strings continue to use LoadAsync.
MergeAsyncMerges application data into an isolated document snapshot before replacing the current workbook.
PreviewConsolidateAsyncPlans aggregation from A1 source ranges into an active worksheet destination without editing cells; reports occupied output cells.
PreviewRemoveDuplicatesAsyncFinds duplicate rows in an active worksheet A1 range without editing cells; returns counts and a detached write plan.
PreviewTextToColumnsAsyncPlans a text split without editing cells. The JSON result includes destination, dimensions, writes and overwriteCount.
RecalculateAsyncPerforms an operation on this document without activating another worksheet.
RemoveDuplicatesAsyncRemoves duplicate rows using the requested columns/header options; returns counts and records an undoable edit.
SaveAsyncSaves a detached binary document snapshot; export metadata never changes the live workbook.
SaveTextAsyncSaves CSV, XML or JSON text through the owning control, omitting a generated CSV BOM while preserving save events and UTF-8 byte limits.
SetActiveViewAsyncSelects an existing worksheet or dashboard. Does not change worksheet selection or filters.
SetAutoFilterAsyncConfigures the active worksheet filter from a portable range/criteria object; null removes the filter.
SetMailMergeAsync
SetThemeAsyncReplaces workbook-wide theme colors with the validated ordered color palette; updates dependent styles and charts.
SetUserNameAsyncChanges the current comment author; this string is not saved as a workbook setting.
SortRangeAsyncSorts an A1 range on the active worksheet using validated sort keys; preserves row relationships and records one undo operation.
TextToColumnsAsyncSplits text in an active worksheet A1 range. Options define delimiters, destination and explicit overwrite permission; returns the applied plan.
UpdateCellStyleAsyncUpdates a workbook-wide named style; returns its stable identifier as a JSON string and refreshes affected cells.
UpdateConditionalRuleAsyncApplies 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);
}

See Also