HotXLS Docs

ODS Pivot row paths

The local OpenDocument bridge models supported data-pilot views with two through eight real row fields and one through sixteen numeric SUM, MIN, MAX, COUNT or AVERAGE measures, retaining a typed local cache and an editable Pivot view

Parent and child identity

The source is one adjacent local rectangle with unique headers, nonempty string row fields and supported finite numeric measure fields; Boolean, date, subnormal, text, empty and error measure values are outside this profile

Every source column belongs to a row field or at least one measure, and each source field has one role; the number of distinct measure source columns can be smaller than the number of measure occurrences

Each row path is identified by actual field and cache-member positions, so the same child name under different parents remains distinct; display text and separator characters do not supply path identity

The represented tabular layout uses NAME sorting or the finite selected-measure DATA ordering described below, represented expanded or collapsed details, no repeated row labels and a visible grand total; supported member visibility retains represented hidden parents and their source-derived visible subtotals and totals

Selected-measure DATA sorting within complete parent paths

Two through eight ordered row fields can sort ascending or descending by any selected measure in the represented 1..16-measure SUM, MIN, MAX, COUNT or AVERAGE layout; set each DATA-sorted field's SortDataField to that zero-based DataFields ordinal and select xlpfstAscending or xlpfstDescending through SortType

SortDataField=-1 retains NAME sorting; DATA aliases use the exact source-field name and its ordered occurrence, so repeated display captions or equal aggregate values do not select or merge measures

For example, Sales SUM, Cost AVERAGE and Sales COUNT have distinct measure ordinals; their OpenDocument DATA identities are Sales, Cost and Sales*, independently of their display captions

Unknown or ambiguous aliases are refused, and multi-measure DATA profiles reserve trailing asterisks for source-occurrence identities rather than admitting a source name that would collide with that encoding

Sibling members are compared within their complete actual parent prefix, using contributing visible source records once rather than regrouping display text or summing repeated subtotal cells

AVERAGE ordering uses the source-weighted aggregate state, so unequal child sizes are not ordered by an average of displayed child averages; the existing persisted fifteen-significant-digit agreement remains required

Numeric ties retain deterministic NAME ordering, hidden members retain their source-bound visibility and matching parent subtotals retain the existing concrete-function and caption contract

Row-member display captions do not change source-based NAME keys or DATA tie-breaking; homogeneous parent subtotals still require their matching concrete function, and mixed-function measures still require no parent subtotals

Row-member display captions

Represented members in the two-through-eight-row-field profile retain Pivot.Fields[FieldIndex].Items[ItemIndex].Caption separately from the source cache value and member ordinal

The OpenDocument member keeps its raw table:name and stores the display text as an independent extension attribute; duplicate display captions and captions that sort differently from the original values do not merge or reorder source identities

Ordinary labels, collapsed prefix labels and the member portion of parent subtotal labels use the caption when present; subtotal functions, source-weighted arithmetic and the source-owned subtotal template retain their existing rules

Captions must be nonempty valid XML text with at most 32,767 UTF-16 code units, within the caller's preparation budget; a result that still contains an old or independently changed label is not current merely because the source members remain valid

Import restores the caption onto the matching typed view item only after the entire source and result grid agree; the cache retains the original values, including when multiple view members share a display name

After changing source values, refresh the actual cache and call MaterializeOdsPivotTable; a sort-setting change requires rematerialization of the current cache, and saving still requires the complete current source, cache, view, result grid and captured ownership

Collapsed nonterminal member details

Within the represented two through eight row fields, set a nonterminal member's IsDetailHidden to true to collapse its descendant paths into one aggregate row for that actual member prefix; other branches can remain expanded

The flag belongs to the member in that Pivot field; occurrences of the same cache member under different parents share that field-item setting, without sharing the collapse flag between different Pivot views

When several collapsed members occur on one path, the shallowest collapsed prefix determines the displayed row; descendant source records still contribute exactly once to that row, matching ancestor subtotals and the grand total

Each measure keeps its own source-derived aggregate state: SUM combines source values, COUNT counts contributing records, and AVERAGE uses the contributing sum and record count rather than averaging displayed child values; represented MIN and MAX retain their existing source reductions

OpenDocument saving writes the represented show-details state, and supported typed reopening restores IsDetailHidden; an innermost row member can retain the flag without changing the displayed rows because it has no inner detail level

Collapse composes with NAME sorting and the existing selected-measure DATA ordinal contract, including a second measure occurrence over the same source field; matching homogeneous subtotals, source-owned captions and the no-subtotal requirement for mixed functions remain unchanged

After changing a collapse flag, call MaterializeOdsPivotTable before saving; the full source, cache, member state, result grid, ownership and preparation budget must still agree

Supported collapsed SUM and AVERAGE views can be refreshed in LibreOffice Calc and returned to typed local Pivot views, retaining their represented source-member flags, source-derived totals and source-owned subtotal captions; this does not admit arbitrary native Pivot layouts

Independent measure occurrences

Each measure retains its own ordinal, source-field reference, function and display caption; several measures may use the same numeric source field, and captions may repeat without merging the occurrences

Two measures both displayed as Sales can therefore remain a Sales SUM and a Sales COUNT, and two distinct numeric source columns remain separate even when some result values happen to agree

When the measures use different functions, parent subtotals must be disabled; when every measure uses the same function, represented parent fields may use that one matching subtotal function, while the final row field has no subtotal

Source-derived SUM, MIN, MAX, COUNT and AVERAGE

Each leaf, matching parent subtotal and grand total is derived independently for each measure from its contributing source records; repeated source tuples retain their actual multiplicity, including negative and zero numeric values

COUNT retains the existing CountA-style record-count function over the admitted numeric source domain, counting contributing records rather than summing their values; this does not add CountNums or text, blank and error coercion rules

AVERAGE uses the contributing source sum and source-record count, so uneven child groups produce a source-weighted parent or grand average rather than an unweighted average of displayed child averages

The existing 15-significant-digit persisted comparison applies to AVERAGE and COUNT remains exact; nonfinite values and inconsistent source-derived results are refused without a new general floating-point tolerance

Source-owned headers and captions

One measure retains its represented one-header-row layout; multiple measures use two complete header rows with one synthetic column data-layout field and no real column dimensions

The first header row is blank except for Pivot.DataCaption at the first measure column, and the second contains every row-field name followed by the measure captions in ordinal order

The data-layout caption is written explicitly, so its identity comes from the view model rather than an application locale default; measure and grand-total captions remain separate model values

Successful OpenDocument materialization sets the actual result rectangle and FirstDataRow; changing a location property or inserting a caption cell does not by itself establish a current result

For public authoring, set the represented row fields' Compact, Outline and SubtotalTop properties to false, retain their ordered Position, enable IncludeNewItemsInFilter and select NAME sorting or an admitted DATA ordinal, then call MaterializeOdsPivotTable

Pivot.AddDataFieldByName('Sales', xlpaSum).DisplayName := 'Sales';
Pivot.AddDataFieldByName('Sales', xlpaCount).DisplayName := 'Sales';
Pivot.DataCaption := 'Values';
if Workbook.MaterializeOdsPivotTable(Pivot) <> 1 then
  raise Exception.Create('OpenDocument Pivot materialization failed');

This example assumes the local source and ordered row fields have already been configured, with no unused source columns or parent subtotals for the mixed SUM/COUNT pair

Represented parent subtotals carry an explicit member-caption template, so refresh preserves the source-owned caption instead of choosing an application's translated default subtotal word

The file uses an automatic subtotal with that exact template only when all measures have the same concrete aggregation and the represented parent subtotal matches it; importing the supported encoding restores that concrete subtotal function

A single-measure SUM keeps its existing measure-caption suffix, including literal question marks and backslashes; multiple measures keep the represented subtotal word, and member names containing those characters remain literal text

Unknown templates, missing caption ownership and mixed-function parent subtotals remain unsupported; a caption spelling does not choose or change a measure's aggregation

One complete result projection

Admission checks the full header shape, source members, captions and numeric values; the complete result must match one coherent supported projection, including its subtotal-caption and ancestor-label rules

Library materialization repeats unchanged ancestor labels after a subtotal row, while supported native refresh can keep those prefixes suppressed; native output may retain either the existing subtotal-caption convention or the represented source-owned subtotal template, and the complete rectangle must follow one of those projections consistently

Caption and prefix spellings cannot be selected independently for different cells, rows or measures; a mixture of repeated and suppressed ancestor labels does not become a valid complete projection

A one-row-shifted result, a missing data-layout caption, arbitrary subtotal text or independently changed numeric cell does not become current merely because individual values can be found elsewhere in the output

Explicit refresh and materialization

  1. Use the actual typed Pivot and cache in the current workbook
  2. After changing source values or row members, call RefreshPivotCache for that cache's current identifier
  3. Call MaterializeOdsPivotTable before exporting the changed result
  4. Save only when the live source, cache, view settings, complete grid and captured result ownership agree

The explicit OpenDocument consumer selects this represented shape and caption convention; ordinary Excel materialization retains its own layout policy

Failed materialization preserves held cell identity and existing result ownership; it does not grant permission to replace changed result cells, formulas, unrelated cells or colliding ranges

Independently owned reopen and stream saving

An admitted reopened workbook owns its local source records, typed cache and result ownership, so the originating workbook can be destroyed, its input stream released and its original file path made unavailable before further supported saving, source edits, refresh and rematerialization

The represented collapsed profiles retain their typed cache, member flags and source-derived grid through two successive OpenDocument saves and reopens after releasing each originating workbook and input stream, including when the original input path is unavailable during the next save

The local source worksheet inside the reopened workbook remains required; this ownership guarantee does not turn a missing source range or an external connection into a supported local source

Copying metadata and complete worksheets

A metadata-only AddPivotTableCopy validates the attached source and its represented currentness, clones an independent cache and view, and does not transfer the original result cells' ownership declaration to an empty destination

Provide the represented local source in the destination workbook, refresh if its values differ from the cloned cache, and explicitly materialize the copied view into a safe destination before saving its result

Whole-worksheet graph copying carries represented cells, typed Pivot state, captions, coordinate references and result ownership together, including the two-header data-start relationship and subsequent use after the source workbook is released

Copy operations create independent mutable cache models; ODS persistence can canonicalize views over the same verified live source when reopening, so private cache identifiers and cache object separation are not promised across formats

Such canonicalization requires current source/cache agreement for every view and does not merge unrelated, stale or unresolved sources merely because their range text looks alike

Validation and unsupported contexts

Import validates complete source and result rectangles before constructing typed views; unsupported or inconsistent imported collections retain raw ownership, while unsupported typed output is reported and refused before destination publication

Descriptor text, captions, measure records, source paths, numeric work and XML staging remain bounded; insufficient budget refuses before publishing a partial result, and an adequate limit permits a healthy retry

Unknown members, duplicate row levels, mismatched subtotal functions, stale source/cache state, changed result ownership, output collisions and unrepresented or foreign copy contexts remain checked boundaries

Real column hierarchies, external or OLAP sources, interactive combinations and arbitrary imported OOXML Pivot conversion remain outside this row-path profile; the separate column-hierarchy profile carries its single row-axis captions under its own full-frame and sparse-header ownership rules

Consecutive subtotals still require one supported complete label projection; enabling collapse does not admit a layout whose subtotal labels were already outside that projection

The existing ordinary aggregate, single-row multiple-measure and represented column-hierarchy profiles retain their own layout contracts

This capability belongs to the core library and requires no Small Business or Enterprise addon