ODS Pivot row paths
The local OpenDocument bridge models supported data-pilot views with two to eight real row fields and one to 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, non-empty 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 to at least one measure, and a source field has exactly one role; there may be fewer distinct measure source columns than measure occurrences
A row path is identified by its actual field and cache-member positions, so the same child name under different parents stays distinct; neither display text nor separator characters give a path its identity
The represented tabular layout uses NAME sorting or the finite selected-measure DATA ordering described below, with details represented as expanded or collapsed, no repeated row labels and a visible grand total; supported member visibility keeps represented hidden parents together with their source-derived visible subtotals and totals
Selected-measure DATA sorting within complete parent paths
Two to 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 keeps NAME sorting; DATA aliases use the exact source-field name and its ordered occurrence, so repeated display captions or equal aggregate values cannot select or merge measures
Take Sales SUM, Cost AVERAGE and Sales COUNT, for instance: each has its own measure ordinal, and their OpenDocument DATA identities are Sales, Cost and Sales*, independently of their display captions
Aliases that are unknown or ambiguous are refused, and multi-measure DATA profiles keep trailing asterisks for source-occurrence identities instead of accepting a source name that would collide with that encoding
Sibling members are compared within their full actual parent prefix, with contributing visible source records used once, rather than by regrouping display text or summing repeated subtotal cells
AVERAGE ordering works from the source-weighted aggregate state, so children of unequal size are not ordered by an average of the displayed child averages; the existing persisted fifteen-significant-digit agreement is still required
Numeric ties keep deterministic NAME ordering, hidden members keep the visibility bound to their source, and matching parent subtotals keep the existing concrete-function and caption contract
Display captions on row members leave the source-based NAME keys and DATA tie-breaking alone; homogeneous parent subtotals still need their matching concrete function, and measures with mixed functions 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 keeps the display text in an independent extension attribute; duplicated display captions, and captions sorting differently from the original values, neither merge nor reorder source identities
Ordinary labels, collapsed prefix labels and the member part of parent subtotal labels use the caption where one exists; subtotal functions, source-weighted arithmetic and the source-owned subtotal template keep their existing rules
Captions have to be nonempty valid XML text of at most 32,767 UTF-16 code units and must fit the caller's preparation budget; a result still holding an old or independently altered label is not current just because the source members remain valid
Import puts the caption back on the matching typed view item only once the whole source and result grid agree; the cache keeps the original values, even where several view members share a display name
After changing source values, refresh the actual cache and call MaterializeOdsPivotTable; a sort-setting change requires rematerialisation 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 to eight row fields, set a nonterminal member's IsDetailHidden to true in order to collapse its descendant paths into a single aggregate row for that actual member prefix; other branches may stay expanded
The flag belongs to the member within that Pivot field; occurrences of the same cache member beneath different parents share the field-item setting, but the collapse flag is not shared between different Pivot views
Where one path carries several collapsed members, the shallowest collapsed prefix decides the displayed row; descendant source records still contribute exactly once to that row, matching the ancestor subtotals and the grand total
Every measure keeps a source-derived aggregate state of its own: SUM combines source values, COUNT counts contributing records and AVERAGE uses the contributing sum and record count instead of averaging displayed child values; represented MIN and MAX keep their existing source reductions
OpenDocument saving writes the represented show-details state, and supported typed reopening restores IsDetailHidden; an innermost row member may keep the flag without altering the displayed rows, since it has no inner detail level
Collapse works together with NAME sorting and the existing selected-measure DATA ordinal contract, even for a second measure occurrence over the same source field; matching homogeneous subtotals, source-owned captions and the no-subtotal rule for mixed functions stay unchanged
After changing a collapse flag, call MaterializeOdsPivotTable before saving; the full source, cache, member state, result grid, ownership and preparation budget still have to agree
Supported collapsed SUM and AVERAGE views can be refreshed in LibreOffice Calc and brought back as typed local Pivot views, keeping their represented source-member flags, source-derived totals and source-owned subtotal captions; arbitrary native Pivot layouts are still not admitted
Independent measure occurrences
Every measure keeps its own ordinal, source-field reference, function and display caption; several measures can draw on the same numeric source field, and captions may repeat without merging the occurrences
So two measures both shown as Sales can remain a Sales SUM and a Sales COUNT, and two distinct numeric source columns stay separate even where some result values happen to match
Where the measures use different functions, parent subtotals have to be switched off; where every measure uses the same function, represented parent fields may take that one matching subtotal function, and the final row field carries no subtotal
Source-derived SUM, MIN, MAX, COUNT and AVERAGE
For every measure, each leaf, matching parent subtotal and grand total is derived separately from the source records that contribute to it; repeated source tuples keep their actual multiplicity, negative and zero numeric values included
COUNT keeps the existing CountA-style record-count function over the admitted numeric source domain, counting contributing records instead of summing their values; CountNums and coercion rules for text, blanks and errors are not added
AVERAGE uses the contributing source sum and source-record count, so uneven child groups yield a source-weighted parent or grand average instead of an unweighted mean of displayed child averages
The existing persisted comparison at 15 significant digits applies to AVERAGE, while COUNT stays exact; nonfinite values and inconsistent source-derived results are refused, with no new general floating-point tolerance
Source-owned headers and captions
A single measure keeps its represented one-header-row layout; several measures use two complete header rows, 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, while the second holds every row-field name followed by the measure captions in ordinal order
The data-layout caption is written out explicitly, so its identity comes from the view model, not from an application locale default; measure and grand-total captions stay separate model values
Successful OpenDocument materialisation sets the actual result rectangle and FirstDataRow; changing a location property, or inserting a caption cell, does not by itself make a result current
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 takes it that the local source and the ordered row fields are already configured, with no unused source columns or parent subtotals for the mixed SUM and COUNT pair
Represented parent subtotals hold an explicit member-caption template, so a refresh keeps the source-owned caption rather than picking an application's translated default subtotal word
The file uses an automatic subtotal with that exact template only where every measure has the same concrete aggregation and the represented parent subtotal matches it; importing the supported encoding brings back that concrete subtotal function
A single-measure SUM keeps its existing measure-caption suffix, literal question marks and backslashes included; several measures keep the represented subtotal word, and member names containing those characters stay literal text
Unknown templates, missing caption ownership and mixed-function parent subtotals stay unsupported; the spelling of a caption never selects or alters a measure's aggregation
One complete result projection
Admission checks the whole header shape, source members, captions and numeric values; the complete result has to match one coherent supported projection, including its rules for subtotal captions and ancestor labels
Library materialisation repeats unchanged ancestor labels after a subtotal row, whilst 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 chosen independently for different cells, rows or measures; a mix of repeated and suppressed ancestor labels does not qualify as a valid complete projection
A result shifted by one row, a missing data-layout caption, arbitrary subtotal text or a numeric cell altered on its own does not become current just because individual values can be found elsewhere in the output
Explicit refresh and materialisation
- Use the actual typed Pivot and cache in the current workbook
- After changing source values or row members, call
RefreshPivotCachefor that cache's current identifier - Call
MaterializeOdsPivotTablebefore exporting the changed result - Save only after the live source, cache, view settings, complete grid and captured result ownership have agreed
The explicit OpenDocument consumer selects this represented shape and caption convention; ordinary Excel materialisation retains its own layout policy
Failed materialisation 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 rematerialisation
Represented collapsed profiles keep their typed cache, member flags and source-derived grid across two successive OpenDocument saves and reopens after each originating workbook and input stream has been released, even where the original input path is unavailable during the next save
A local source worksheet inside the reopened workbook is still required; this ownership guarantee does not make a missing source range or an external connection into a supported local source
Copying metadata and complete worksheets
A metadata-only AddPivotTableCopy checks the attached source and its represented currentness, clones a cache and view of its own, and does not hand 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 materialise 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 as one, including the two-header data-start relationship and later use once the source workbook is released
Copy operations create independent mutable cache models; ODS persistence can canonicalise views over the same verified live source when reopening, so private cache identifiers and cache object separation are not promised across formats
Such canonicalisation 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, whilst unsupported typed output is reported and refused before destination publication
Descriptor text, captions, measure records, source paths, numeric work and XML staging all stay bounded; a budget that is too small causes a refusal before any partial result is published, while an adequate limit allows a healthy retry
Unknown members, duplicate row levels, mismatched subtotal functions, stale source or cache state, changed result ownership, output collisions and unrepresented or foreign copy contexts stay as checked boundaries
Real column hierarchies, external or OLAP sources, interactive combinations and arbitrary conversion of imported OOXML Pivots stay outside this row-path profile; the separate column-hierarchy profile holds its single row-axis captions under its own ownership rules for the full frame and sparse headers
Consecutive subtotals still demand one supported complete label projection; switching on collapse does not admit a layout whose subtotal labels already fell outside that projection
The existing ordinary aggregate, single-row multiple-measure and represented column-hierarchy profiles retain their own layout contracts
The capability sits in the core library and needs no Small Business or Enterprise add-on