HotXLS Docs

TXLSPivotTable class

Represents an Excel PivotTable shared by the classic XLS and modern XLSX engines, with typed access to its cache, row and column axes, data fields, layout settings, calculated definitions and materialised result matrix

Syntax

type TXLSPivotTable = class

Result materialization

Call Make after the bound cache has been populated to group cache records by the configured row and column fields and pass the resulting cells to a TlxPivotResultWriter callback

Supported aggregations

Sum, Count, Average, Max, Min, Product, CountNums, StdDev, StdDevP, Var, and VarP

Show values as

Normal, Difference, Percent, PercentDiff, RunTotal, PercentOfRow, PercentOfCol, PercentOfTotal and Index are all supported
The XLSX extension modes add xlpesdaPercentOfParent, xlpesdaPercentOfParentRow, xlpesdaPercentOfParentColumn, xlpesdaPercentOfRunningTotal, xlpesdaRankAscending and xlpesdaRankDescending
Comparison modes work from a zero-based pivot-field BaseField together with an explicit BaseItem, xlPivotBaseItemPrevious or xlPivotBaseItemNext

Delphi example

Pivot.AddRowField('Region');
Pivot.AddColumnField('Quarter');
RevenueField := Pivot.AddDataFieldByName('Revenue', xlpaSum);
RevenueField.DisplayName := 'Revenue';
UnitsField := Pivot.AddDataFieldByName('Units', xlpaAverage);
UnitsField.DisplayName := 'Average units';
Pivot.DataFieldAxisIsRow := False;
CellsWritten := Pivot.Make(ResultWriter.WriteCell);

Report captions and empty totals

GrandTotalCaption keeps the represented grand-total label through assignment, supported import, native layout and preview; an empty value falls back to the Grand Total wording

For the qualified visible, unconstrained, ordinary SUM empty total, GetDataValue and GETPIVOTDATA give back numeric zero; unknown measures, constrained unknown items and hidden totals keep their existing refusal behaviour

See retained Timeline conjunctions for native ownership and empty-layout boundaries

Calculated definitions

Calculated cache-field formulas are evaluated per source record, calculated items are evaluated across sibling aggregates, and calculated members whose MemberType is data add virtual data fields once source aggregation has run. Names are case-insensitive, bracketed and quoted names are supported, and acyclic dependencies are resolved in deterministic passes