modern-xlsx API Reference - v1.3.0
    Preparing search index...

    Interface PivotTableData

    A pivot table, xl/pivotTables/pivotTable{n}.xml. The rowItems and colItems layout caches and pivotTableStyleInfo are dropped on read.

    The writer does not compute the table's layout or its cell values. For a table built in code (a row, column or page field with empty items), it completes the items (see PivotFieldData.items) and writes refreshOnLoad="1" on the cache the table uses, so Excel lays the table out and shows its values when it opens the file (and marks the workbook changed). Read back, the table has those items, so its cache is written without refreshOnLoad: the table shows the values in its cells, which Excel saves with the file, and a file no Excel has saved shows them after a refresh.

    On write, pivotFields gets empty fields up to the number of fields in the cache that cacheId names, because Excel refuses a table with fewer; the model is not changed.

    interface PivotTableData {
        cacheId: number;
        colFields: PivotFieldRef[];
        dataCaption?: string;
        dataFields: PivotDataFieldData[];
        location: PivotLocation;
        name: string;
        pageFields: PivotPageFieldData[];
        pivotFields: PivotFieldData[];
        rowFields: PivotFieldRef[];
    }
    Index
    cacheId: number

    The cache this table summarises: a PivotCacheDefinitionData.cacheId, or the cache's 0-based index in WorkbookData.pivotCaches when that is unset.

    colFields: PivotFieldRef[]
    dataCaption?: string

    dataCaption; unset is written as 'Values'.

    dataFields: PivotDataFieldData[]
    location: PivotLocation
    name: string
    pageFields: PivotPageFieldData[]
    pivotFields: PivotFieldData[]
    rowFields: PivotFieldRef[]