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 materialized 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 send 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 supported
XLSX extension modes add xlpesdaPercentOfParent, xlpesdaPercentOfParentRow, xlpesdaPercentOfParentColumn, xlpesdaPercentOfRunningTotal, xlpesdaRankAscending, and xlpesdaRankDescending
Comparison modes use a zero-based pivot-field BaseField and 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 retains the represented grand-total label through assignment, supported import, native layout and preview; an empty value keeps the Grand Total fallback

For the qualified visible, unconstrained, ordinary SUM empty total, GetDataValue and GETPIVOTDATA return numeric zero; unknown measures, constrained unknown items and hidden totals retain their existing refusal behavior

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

Calculated definitions

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