mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-21 15:49:26 +00:00
0f318f0aa6
Introduces a first-class, read-only representation of pivot tables that already exist in a loaded Xlsx file (issue #4534). Previously pivot tables were completely inaccessible from the object model. New model classes under Worksheet\PivotTable: - PivotTable: name, location, source cache definition and field layout, with axis helpers (getRowFields/getColumnFields/getPageFields/getDataFields). - PivotCacheDefinition: cache id, source worksheet/range and cache field names. - PivotField: field index, name, axis placement, and data-field aggregation. Reader\Xlsx\PivotTableReader parses a pivotTableDefinition part and its associated pivotCacheDefinition part into that model. The main Xlsx reader discovers pivot parts via worksheet relationships and wires them up (skipped under setReadDataOnly). Worksheet gains getPivotTableCollection(), getPivotTables(), addPivotTable(), getPivotTableByName(), getPivotTableNames() and removePivotTableCollection(). This is inspection-only: it does not create, modify, recalculate or render pivot tables, and does not change what the writer emits. A minimal pivot-table fixture and functional tests cover reading name, location, cache source, fields and axis placement, plus the read-data-only path.