pub struct PivotGrid {
pub filter_rows: Vec<(String, String)>,
pub header_rows: Vec<Vec<String>>,
pub body_rows: Vec<PivotBodyRow>,
pub width: usize,
pub row_axis: Vec<PivotAxisItem>,
pub col_axis: Vec<PivotAxisItem>,
}Expand description
A fully computed pivot result, ready to be materialized into a sheet:
filter_rows (if any) come first, then a blank spacer row, then
header_rows, then one entry of body_rows per output row – mirroring
Excel’s own report-filter placement (verified against real Excel: it
always reserves one row per filter field plus a blank spacer above the
row/column header grid, and captions each with a “(All)”/“(Multiple
Items)” state – never a specific value’s name, since that’s specific to
the classic single-select page-field mode Excel no longer defaults to).
Fields§
§filter_rows: Vec<(String, String)>One (field name, "(All)" | "(Multiple Items)") pair per filter
field, in the order they were added.
header_rows: Vec<Vec<String>>The column-header block above the body: one row per column field, plus a value-field row when there is more than one value field.
body_rows: Vec<PivotBodyRow>The body, one entry per output row, subtotal and grand-total rows included.
width: usizeTotal width in columns (row-label columns + data columns), used by
the caller to know how large a range to clear/allocate. Always >= 2,
so filter_rows’ two columns (name, state) always fit within it.
row_axis: Vec<PivotAxisItem>The flattened row/column axis groups underlying body_rows/the data
columns, exposed (independent of display formatting) so an xlsx
exporter can reconstruct a native pivotTableDefinition’s
rowItems/colItems without re-deriving the grouping itself.
col_axis: Vec<PivotAxisItem>Column half of that axis pair; see PivotGrid::row_axis.