HotXLS Docs

Pivot format ownership and workbook copies

Version 2.384.144 preserves represented PivotTable number formats, custom Pivot styles and standard differential area formatting across modern workbook-local style pools, taking in save-time compaction and repeated saves

Copy an attached PivotTable

TXLSXWorksheet.AddPivotTableCopy clones an attached source PivotTable and cache into the destination workbook, resolves custom number-format codes in the source owner, and records independent destination identities

The destination may already contain unrelated custom number formats, conditional formats and Pivot styles with the same numeric identities; those existing styles keep their own meaning

Copies receive a unique cache identity and independent mutable state; a default copied name is given an available suffix, whilst an explicitly duplicated name is refused

Source worksheet, range, query and external-workbook bindings keep their stored meaning; supply the destination source data before requesting a native refresh

Author and interpret number formats

TXLSXWorksheet.PivotSetDataFieldFormat takes a data field attached to the current workbook and a nonempty format code, registers that code in the workbook pool, and gives back its one-based custom-pool index

A foreign or detached data field is rejected with 0 without adding a format; the worksheet receiver may be any worksheet in the data field's owning workbook

Direct assignments to TXLSPivotDataField.NumberFormat use the authored one-based custom-pool convention, with 0 for General; imported modern values keep their native OOXML identity until explicitly replaced

Use PivotSetDataFieldFormat to author a format by code instead of assigning an imported native number-format ID as a custom-pool index

TXLSPivotCacheField.NumberFormat and TXLSPivotField.NumFmtId keep native OOXML IDs in modern workbooks; copying resolves each supported custom ID through its actual source format code

Sparse imported IDs are normalised through the actual source styles mapping, and imported built-in IDs remain built-in; unknown or overflowing custom identities keep their source data but refuse operations that require an unresolved mapping

Retain differential area formatting

TXLSPivotTable.FormatsXml binds represented area-format references to workbook-owned differential styles, quite independently of the transient conditional-format pool

Standard font, fill, border, alignment, protection and number-format overrides survive copying, saving, reopening and repeated saves even when the destination already occupies their original numeric IDs

Cross-workbook copies resolve indexed and theme colours in the source workbook before storing their copied RGB appearance; same-workbook copies preserve their original theme-font schemes in the existing owner context

Copied differential fonts resolve their explicit names or supported source-native fallback in the owning workbook context, including recognised default-theme version profiles; a complete source minor or major theme font collection maps to the destination slot holding the equal complete collection; when neither complete collection matches, the original represented scheme stays bound to the destination theme

Custom Pivot style sections own their complete imported differential objects, and conflicting destination names are given a new name; unresolved or unsafe foreign identities and a destination custom style shadowing a source built-in name are refused

Preserve the native default font

Modern XLSX saving retains the represented source font zero, including its name, fractional point size, emphasis, colour, family, charset and scheme; this preserves supported differential-font fallback after saving and reopening

The native default font is separate from the public custom font pool: Fonts[0] is the first pool entry and is written out as native font 1, so editing it does not replace native font zero

New workbooks keep the existing implicit Calibri default, and the existing XLSB default-font override keeps priority

Save and compact without losing identities

Formats referenced only by Pivot models and differential styles stay live during style-pool compaction; their represented and retained raw number-format references are remapped together

Owned Pivot differential entries are registered ahead of borrowed conditional styles on every save, with custom table-style differential entries following that combined prefix

Normalised owned Pivot definitions take precedence over original compressed-part replay, so sparse imported IDs cannot be restored accidentally during saving

Rejection and remaining boundaries

AddPivotTableCopy returns nil when source format ownership is unknown, a custom identity cannot be resolved, differential appearance cannot be mapped faithfully, or unsupported opaque identities call for remapping

Validation and allocation are staged before appending the destination cache, table and style objects; rejected copies leave destination number-format, differential-style, table and cache collections untouched

Detached models do not inherit a borrowed workbook format owner through Assign or AssignPivotOnly; keep the source attached whilst copying workbook-local custom formats

Cross-workbook copies preserve the strictly validated identity-free x14 hideValuesRow extension and empty xpdl:pivotTableDefinition16 extension; other unknown extensions and supplemental opaque Pivot records stay explicit boundaries

Unknown differential appearance XML stays preserved in its source owner and refuses cross-workbook mapping when its identity safety cannot be established

The focused qualification uses the existing RAD Studio 37.0 Win64 compiler and independent Excel appearance controls; it establishes no broader compiler or platform matrix

Cross-workbook copies carry unequal theme font schemes unchanged: where no equal complete script collection exists in the destination, the differential hangs on to its scheme attribute and the destination theme resolves the slot at render time, matching native sheet-move copies; concrete fonts continue to go across by value into the destination style pool

Differential future-feature extensions carry opaquely: an extLst inside a copied differential goes through verbatim without semantic interpretation, as native refresh and save preserve it; foreign namespaces outside extension subtrees keep their explicit-remapping refusal

Unequal theme scheme persistence

Version 2.384.316 fixes the unequal-collection path documented earlier in 2.384.310: the earlier qualification exercised an equal-collection mapping and never established its unequal fallback

Where a represented nonuniform source font collection has no equal destination collection, copying keeps its original major or minor scheme and stored font properties; an equal opposite-slot collection still takes precedence

The destination theme decides the resulting glyph face, so copying a theme scheme across deliberately different themes promises no identical glyph appearance

Version 2.384.317 adds complete owned custom-style section persistence for the qualified underline, explicit false emphasis and custom number-format profile; other appearance combinations and opaque foreign identities keep their documented boundaries

Own custom Pivot style-section differentials

Imported custom table-style sections retain a complete differential object separately from their existing appearance summary; cross-workbook Pivot copies stage its number-format identities in the destination owner and preserve its complete represented XML

The qualified whole-table section keeps underline, explicitly disabled bold and italic, and a custom number format through source resaving, copying, source destruction, destination edits, pool compaction, saving, reopening and native Pivot refresh

Loaded table and Pivot availability flags honour their default true value when omitted, and accept the standard explicit XML boolean values

Calling SetSection or SetSectionEx replaces the imported section with the caller's requested summary and wipes its previous differential object and unsupported-summary state

Unresolved number-format identities and foreign differential structures refuse the copy before destination caches, PivotTables, custom styles or number-format pools change

Actual native DisplayFormat qualification additionally covers source-owned theme/tinted and indexed font colours, a non-solid pattern and a linear gradient across copying, editing, saving, reopening and native refresh; destination themes and palettes deliberately differ in those controls

In the selected whole-table section profile, Excel keeps the custom number-format differential but displays General on both the source and the copies; use the separately qualified Pivot data-field formatting API for visible custom measure formats

Native copies preserve the represented applied values and formatting; unspecified font faces resolve in the destination workbook context, and no pixel-identical font promise is given

Portable rendering continues to turn away richer section appearances that its current summary cannot represent; foreign or unresolved identities keep their explicit remapping boundary

Copied result ownership and OpenDocument caches

For represented materialized local views, a metadata-only AddPivotTableCopy first checks the attached source and its represented currentness, then clones independent mutable cache and table state without taking an absolute claim on the original result cells

Before the copied view is materialised, the destination must hold the represented local source; a different source needs an explicit refresh, and materialisation still refuses occupied unowned cells, stale captures and other unsafe destinations

Whole-worksheet graph copying moves represented source/result coordinates, typed Pivot metadata and owned result values as one, including the OpenDocument two-header layout, explicit data caption and first-data-row relationship

Independent cache models in a copy do not make private cache identities stable across formats; when ODS is saved and reopened, views may be canonicalised over the same verified live source, once each view's source/cache agreement has been validated

Cache identifiers are workbook-local references, so use the current view's CacheId after a reopen, and an old private identifier should not be taken as persistent source identity

Unknown extension content is never silently dropped or given represented ownership; unresolved source, foreign context, stale result and the explicit copy/remapping boundaries all stay checked

For represented homogeneous parent subtotals, an automatic subtotal can be persisted with a canonical source-owned member-caption template; importing it brings back the original concrete subtotal aggregation instead of guessing a function from the caption text

The existing single-measure SUM suffix stays as the actual measure caption, preserving literal question marks and backslashes, while the supported multiple-measure suffix stays the represented subtotal word