> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reducto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Types: layout and fonts: PivotTables and slicers

## `CalcItemInfo`

A calculated item: its field, its name and its formula as the dialog shows it.

Import from `@reductoai/xlsx/editor`.

| Name | Type | Description |
| - | - | - |
| `field` | `string` | |
| `formula` | `string` | |
| `name` | `string` | |

## `FieldSubtotals`

`Excel.Subtotals`: `automatic` is the field's default subtotal, the rest are custom ones.

Not exported by name. You get it from the API.

```ts theme={null}
type FieldSubtotals = Record<typeof SUBTOTAL_KEYS[number], boolean>
```

## `PivotDataField`

One data field: its caption, the source field it sums and how.

Import from `@reductoai/xlsx`.

| Name | Type | Description |
| - | - | - |
| `field` | `string` | |
| `name` | `string` | |
| `numFmtId` | `number \| null` | |
| `summarizeBy` | `string` | |

## `PivotDataSpec`

`numFmtId` formats the field's value cells; 0 or absent is General.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `fld` | `number` | |
| `name` | `string` | |
| `numFmtId?` | `number` | |
| `showAs?` | `ShowAsSpec` | |
| `subtotal` | `Aggregate` | |

## `PivotFieldFilter`

A field's items in the order the field lists them, and which ones its filter shows.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `expanded` | `boolean[]` | Whether each item shows its inner items (`sd`). |
| `items` | `Scalar[]` | |
| `multiple` | `boolean` | |
| `names` | `string[]` | Each item's name, as `PivotItem.name` gives it. |
| `page` | `boolean` | A filter field shows one item, or several with `multipleItemSelectionAllowed`. |
| `sort` | `"ascending" \| "descending" \| null` | |
| `visible` | `boolean[]` | |

## `PivotFilterKind`

Not exported by name. You get it from the API.

```ts theme={null}
type PivotFilterKind = "Unknown" | "Value" | "Manual" | "Label" | "Date"
```

## `PivotFlags`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `allowMultipleFiltersPerField` | `boolean` | |
| `altTextDescription` | `string` | |
| `altTextTitle` | `string` | |
| `autoFormat` | `boolean` | |
| `displayErrorString` | `boolean` | |
| `emptyCellText` | `string` | |
| `enableDataValueEditing` | `boolean` | |
| `enableFieldList` | `boolean` | |
| `errorString` | `string` | "For error values show": VBA `ErrorString` and `DisplayErrorString`. |
| `fillEmptyCells` | `boolean` | |
| `missingItemsLimit` | `number` | Number of items to retain per field, read at the next refresh: -1 Automatic, 0 None. |
| `preserveFormatting` | `boolean` | |
| `refreshOnOpen` | `boolean` | |
| `showColHeaders` | `boolean` | |
| `showColStripes` | `boolean` | |
| `showDrill` | `boolean` | The +/- buttons on item labels. |
| `showHeaders` | `boolean` | Field captions and filter buttons (Field Headers). |
| `showLastColumn` | `boolean` | |
| `showRowHeaders` | `boolean` | The pivot style's options: `pivotTableStyleInfo` attributes of the same names. |
| `showRowStripes` | `boolean` | |
| `style` | `string` | The pivot style's name; "" is None. |
| `useCustomSortLists` | `boolean` | |

## `PivotGrouping`

What the Grouping window shows: the field's groups, or Excel's proposal for a field without.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `autoEnd` | `boolean` | |
| `autoStart` | `boolean` | |
| `by` | `number` | The step: a number group's size, or the number of days when grouping by days. |
| `dates` | `boolean` | |
| `end` | `number` | |
| `field` | `string` | The source field the groups are made from. |
| `grouped` | `boolean` | |
| `periods` | `Period[]` | |
| `start` | `number` | |

## `PivotGroupOptions`

VBA's `Range.Group`: numbers in steps of `by`, or dates by `periods` (days in steps of `by`).
`items`: labels of a text field to put in one named group instead.

Import from `@reductoai/xlsx/officejs`.

| Name | Type | Description |
| - | - | - |
| `by?` | `number` | |
| `end?` | `number` | |
| `items?` | `string[]` | |
| `periods?` | `Period[]` | |
| `start?` | `number` | |

## `PivotInfo`

A pivot table part, read for display and for the facade; the cells it shows are the sheet's own.

Import from `@reductoai/xlsx`.

| Name | Type | Description |
| - | - | - |
| `columnGrandTotals` | `boolean` | |
| `columns` | `string[]` | |
| `data` | `PivotDataField[]` | |
| `dataCaption` | `string` | Caption of the Values field, which `x="-2"` names in a row or column list. |
| `filters` | `string[]` | |
| `firstDataCol` | `number` | |
| `firstDataRow` | `number` | |
| `firstHeaderRow` | `number` | Offsets inside `location` from `<location>`, 0-based. |
| `layout` | `PivotLayoutType` | |
| `location` | `Area` | |
| `name` | `string` | |
| `part` | `string` | |
| `rowGrandTotals` | `boolean` | |
| `rows` | `string[]` | |
| `sheet` | `number` | |
| `showHeaders` | `boolean` | Field captions and filter buttons are shown. |
| `source` | `{ name: string \| null; ref: string \| null; sheet: string \| null } \| null` | `<worksheetSource>` of the cache: a sheet range, or a name or table. |
| `style` | `string \| null` | |
| `values` | `{ axis: "rows" \| "columns"; index: number } \| null` | Where the Values field sits among the row or column fields. |

## `PivotLayoutType`

Import from `@reductoai/xlsx`.

```ts theme={null}
type PivotLayoutType = "Compact" | "Outline" | "Tabular"
```

## `PivotOptions`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `columnGrandTotals?` | `boolean` | |
| `layout?` | `PivotLayoutType` | |
| `rowGrandTotals?` | `boolean` | |
| `subtotals?` | `"AtTop" \| "AtBottom" \| "Off"` | |

## `PivotSpec`

`rows` and `cols` may hold `VALUES`, the Values field, where it sits among the fields.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `cols` | `number[]` | |
| `data` | `PivotDataSpec[]` | |
| `pages` | `number[]` | |
| `rows` | `number[]` | |

## `ShowAsCalc`

Not exported by name. You get it from the API.

```ts theme={null}
type ShowAsCalc = typeof SHOW_AS_CALCS[number]
```

## `ShowAsSpec`

`baseField` is a field index; `baseItem` a position in its `<items>`, or one of the two above.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `baseField` | `number` | |
| `baseItem` | `number` | |
| `calc` | `ShowAsCalc` | |
