Skip to main content

Module pivot

Module pivot 

Source
Expand description

PivotTables: reading the source list, grouping and aggregating, laying out the report and writing it onto the sheet as static, styled cells.

Behaviour follows Excel’s documented PivotTable model (rows/columns/values/filters areas, Compact/Outline/Tabular layouts, subtotals, grand totals, show-values-as); the code and the look (our own palette) are original.

Re-exports§

pub use crate::base::quote_sheet;

Structs§

OutCell
Output
A computed report: a dense grid relative to its top-left, with row kinds.
Source
The source list: header names, per-column number formats and the records.

Enums§

CellKind
What a report cell is.
RowKind
What a report row is (for row-wide styling).

Constants§

MAX_AXIS_FIELDS
Most fields in the Rows plus Columns areas.
MAX_OUTPUT_CELLS
Largest report written (cells).
MAX_SOURCE_CELLS
Largest source block read (cells).
MAX_VALUE_FIELDS
Most fields in the Values area.
NOT_A_VALUE_CELL
Why Show Details turns a cell down when it isn’t a value cell of a PivotTable (the front end edits that cell instead).

Functions§

chart_link
The link a PivotChart stores to its PivotTable: Sheet2!PivotTable1.
chart_series
A PivotChart’s series for a report written at origin: categories are the innermost row items, one series per item column (column items × value fields); totals are left out.
clear_output
Clears a pivot’s last output area.
compute
Computes a PivotTable report from the workbook.
detail_cells
The cells of the report grid (relative to its top-left) where detail_records finds records: its value, subtotal and grand total cells, from one computation of the report. The same errors as detail_records.
detail_records
Show Details: the source list and the indices of its records behind the value cell at (row, col) of the report grid (relative to its top-left), in source order. None when that cell holds no value (a label, a header, a blank). An error, for any cell, when the report on the sheet is no longer what the source computes: the cell’s records would be another cell’s.
distinct_labels
Distinct item labels of a source column, sorted like the field list shows them.
func_caption
Excel’s caption verb for a function (“Sum of Sales”). Count Numbers is captioned “Count of Sales”, as Excel names it and as the XLSX reader names a value field saved without a name.
item_label
The label of a source value under a date grouping (for filters and field lists).
links_to
Whether a PivotChart link points at pivot on sheet.
parse_chart_link
(sheet, PivotTable name) of a PivotChart link; a leading [Book.xlsx] is ignored.
range_text
Absolute reference text for a range on a sheet: Sheet1!$A$1:$E$20.
read_source
Reads the source list.
refresh
Recomputes a pivot and writes its report. With replace false, refuses when the target area holds other data. Returns the written area.
resolve_source
Resolves source text (range, table name or defined name) to (sheet, range including header).