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

    Interface PivotCacheDefinitionData

    A pivot cache definition, xl/pivotCache/pivotCacheDefinition{n}.xml. Its refreshOnLoad attribute is not modelled: the reader drops it, and the writer sets it on a cache that a pivot table built in code uses (see PivotTableData).

    interface PivotCacheDefinitionData {
        cacheId?: number | null;
        fields?: CacheFieldData[];
        recordCount?: number;
        relationships?: {
            id: string;
            target: string;
            targetMode?: "External";
            type: string;
        }[];
        source: CacheSource;
    }
    Index
    cacheId?: number | null

    The cacheId workbook.xml gives this cache; pivot tables refer to it through PivotTableData.cacheId. Unset writes the cache's 0-based index; duplicate ids make the write throw (INVALID_WORKBOOK).

    fields?: CacheFieldData[]
    recordCount?: number
    relationships?: {
        id: string;
        target: string;
        targetMode?: "External";
        type: string;
    }[]

    The relationships of the definition's .rels other than the one to its records, such as the externalLinkPath Excel writes for a source in another workbook. Opaque: written back with their ids; the records relationship takes an id none of them uses. Absent when there are none. Skipped with a warning: one of the pivotCacheRecords type, one whose id is empty, does not start with an ASCII letter or _, or holds a character other than an ASCII letter, digit, _, - or . (a source r:id naming such an id is dropped), and a second one with the same id (the first is kept).

    Type Declaration

    • id: string

      Id, which the source names by r:id.

    • target: string

      Target: a file path or URI when external, else a part name relative to the definition.

    • OptionaltargetMode?: "External"

      TargetMode: 'External', or absent for a part inside the package. The writer also reads it in another ASCII letter case (JSON from elsewhere), and writes External.

    • type: string

      Type, the relationship type URI.

    source: CacheSource