TX Sheet Control

PivotTableOptions 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
Derived
PivotTableDefinition

Creation settings shared with JavaScript and TypeScript; settings are validated atomically.

Pivot handles are obtained through the owning workbook or worksheet collection.

Members

MemberDescription
NameWorkbook-unique portable identifier.
SourceLive source binding.
DestinationOutput worksheet and top-left cell.
RowsOrdered row fields.
ColumnsOrdered column fields.
ValuesOrdered measures; duplicate source fields may use different aggregations and captions.
FiltersAND-combined filters.
CalculatedFieldsRecord-level calculated fields.
Layoutcompact, outline, or tabular.
Subtotalstop, bottom, or none.
RowGrandTotalsInclude the grand-total row; defaults to true.
ColumnGrandTotalsInclude grand-total columns; defaults to true.
RepeatLabelsRepeat ancestor labels in tabular/outline output.
ShowHeadersShow the pivot header rows; defaults to true.
ShowFieldButtonsShow interactive field buttons in the editor.
AutoRefreshJoin source edits with automatic pivot refresh in one undo step.
EmptyTextText displayed for missing aggregate results.
StyleNative style and portable colors/banding.
ChartBindingsWorksheet charts that follow the refreshed pivot output.
CollapsedCollapsed row/column member paths.

| MergeLabels | Merge repeated column headers and outline/tabular ancestor row labels; default false. | | CompactIndent | Spaces per compact hierarchy level, 0–20; default 2. | | FilterAreaLayout | Arrange report-only filters above the report. Omitted keeps the existing output layout. | | FilterFieldsPerLine | Fields before wrapping down a column or across a row, 0–64; zero uses one column/row. | | ErrorText | Replacement for source spreadsheet errors and non-finite aggregates; omitted retains normal error behavior. | | AutoFitColumns | Fit output column widths from formatted text on refresh, bounded to 48–360 CSS pixels; default false. | | PreserveFormatting | Retain existing result-cell formatting by position on refresh unless a new pivot style is applied; default false. | | AllowMultipleFiltersPerField | Allow AND-combined filters for the same field; default true. False rejects duplicate field filters. | | UseCustomListsForSorting | Use configured lists and built-in month/day orders before alphabetical axis sorting; default false. | | CustomSortLists | Additional ordered lists used when custom-list sorting is enabled; at most 32 lists of 365 distinct labels. | | ShowExpandCollapseButtons | Display independent row hierarchy expand/collapse controls; default true. | | ShowContextualTooltips | Display field and grid-control context tooltips while retaining accessible labels; default true. | | ClassicLayout | Allow field assignment and reordering by dragging visible grid field headers; default false. | | ShowValuesRow | Show a separate measure-caption header row even for a single measure; default false. | | FieldListSort | Available-field list order; source order by default. Does not reorder the report axes. |

Example

using TXTextControl.TXSheetControl.Server;

await using var control = new ServerSheetControl();
var workbook = control.Workbook;
var source = await workbook.Sheets.AtAsync(0);
await source.Range("A1:D5").SetValuesAsync([
    ["Region", "Category", "Revenue", "Cost"],
    ["Europe", "Software", 1250, 500], ["Europe", "Services", 700, 350],
    ["Americas", "Software", 1800, 900], ["Americas", "Services", 950, 400]
]);
var report = await workbook.Sheets.AddAsync("Sales Pivot");
var pivot = await report.PivotTables.AddAsync(new PivotTableOptions {
    Name = "RegionalSales", Source = new() { SheetId = source.Id, Range = "A1:D5" },
    Destination = new() { SheetId = report.Id, Cell = "B3" },
    Rows = [new() { Field = "Region" }], Columns = [new() { Field = "Category" }],
    Values = [new() { Field = "Revenue", Caption = "Sales", NumberFormatCode = "$#,##0.00" }]
});

See Pivot Tables for field settings, output and lifetime rules.

Constructor

public PivotTableOptions()

Creates an instance with the property defaults shown in this reference. Settings are validated when applied to the owning document; result objects obtained from document operations are detached snapshots.