mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-14 20:16:34 +00:00
c899e5cb75
Extends PivotTableBuilder with the two remaining common pivot capabilities. Page fields: addPageField() places a field on the page (report filter) axis, and the writer emits a <pageFields> section (in its correct schema position, after colFields and before dataFields) with the field marked axis="axisPage". Grouping: a new Worksheet\PivotTable\PivotFieldGroup value object captures how a field is grouped, and the builder gains groupFieldByNumericRange() (fixed-width buckets between a start and end number) and groupFieldByDate() (group a date field by a calendar unit such as quarters or months). The grouping is written into the pivot cache definition as a <fieldGroup> with <rangePr> and computed <groupItems>; with refresh-on-load the spreadsheet application materialises the buckets when it opens the file. The generated cache definition, workbook wiring and content types remain a structurally consistent OPC package, and pivots with page fields or grouping read back into the object model. Tests cover page-field placement/output, numeric range grouping, date quarter grouping, and validation of unknown fields.