TX Sheet Control

PivotTableOptions

Interface

Persisted PivotTable settings; output uses ordinary worksheet cells and is included in worksheet PDF exports.

Package: @txtextcontrol/tx-sheet-control. Obtain operational handles through workbook.pivotTables; settings and results are detached values.

Members

MemberDescription
nameThe name setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
sourceThe source setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
destinationThe destination setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
rowsThe rows setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
columnsThe columns setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
valuesThe values setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
filtersThe filters setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
calculatedFieldsThe calculatedFields setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
layoutThe layout setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
subtotalsThe subtotals setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
rowGrandTotalsThe rowGrandTotals setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
columnGrandTotalsThe columnGrandTotals setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
repeatLabelsThe repeatLabels setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
showHeadersThe showHeaders setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
showFieldButtonsThe showFieldButtons setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
autoRefreshThe autoRefresh setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
emptyTextThe emptyText setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
styleThe style setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.
chartBindingsCharts following this pivot output when it grows, moves, or refreshes.
collapsedThe collapsed setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration.

| 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

In a browser use const workbook = editor.workbook. In Node.js use your server control workbook.

import { Workbook as ExampleWorkbook } from '@txtextcontrol/tx-sheet-control';
const workbook = new ExampleWorkbook();

const source = workbook.sheets.at(0);
source.range('A1:D5').setValues([
    ['Region', 'Category', 'Revenue', 'Cost'],
    ['Europe', 'Software', 1250, 500],
    ['Europe', 'Services', 700, 350],
    ['Americas', 'Software', 1800, 900],
    ['Americas', 'Services', 950, 400]
]);
const report = workbook.sheets.add('Sales Summary');
const pivot = report.pivotTables.add({
    name: 'RegionalSales',
    source: { sheetId: source.id, range: 'A1:D5' },
    destination: { sheetId: report.id, cell: 'B3' },
    rows: [{ field: 'Region' }],
    columns: [{ field: 'Category' }],
    values: [{ field: 'Revenue', caption: 'Sales', numberFormatCode: '$#,##0.00' }],
    layout: 'tabular', style: { rowBanding: true }
});

See Pivot Tables for filtering, calculated values and output.