PivotTableOptions
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
| Member | Description |
|---|---|
| name | The name setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| source | The source setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| destination | The destination setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| rows | The rows setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| columns | The columns setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| values | The values setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| filters | The filters setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| calculatedFields | The calculatedFields setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| layout | The layout setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| subtotals | The subtotals setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| rowGrandTotals | The rowGrandTotals setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| columnGrandTotals | The columnGrandTotals setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| repeatLabels | The repeatLabels setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| showHeaders | The showHeaders setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| showFieldButtons | The showFieldButtons setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| autoRefresh | The autoRefresh setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| emptyText | The emptyText setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| style | The style setting of PivotTableOptions. See the syntax for its supported type and the example for a complete report configuration. |
| chartBindings | Charts following this pivot output when it grows, moves, or refreshes. |
| collapsed | The 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.