Repository navigation
Conversation
…yout settings A refreshed PivotTable read from an Excel file now lays out like Excel's: - Sort by a value field (autoSortScope on data field n): PivotField.sort_by, applied within each parent; pivot.sort takes `by: "Sum of X"`. - Captions: rowHeaderCaption, colHeaderCaption, dataCaption, grandTotalCaption and missingCaption (For empty cells show), field custom names and renamed items (item n). - Manual item order of fields that aren't auto-sorted. - Per-field subtotals (defaultSubtotal, with the table default in pivotTableDefinition16), Repeat Item Labels (fillDownLabels), field number formats, the Values row (hideValuesRow) and the classic layout (gridDropZones). - rowGrandTotals/colGrandTotals were read and written the wrong way round. - Date items sort after text, as in Excel. All settings are written back to XLSX. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Sort by the values in a column (autoSortScope references naming items of the other axis): read, written back and used by the engine, instead of sorting by the grand total. A scope GridCraft can't represent loads as a sort by label, with a warning. - Changing subtotals in Design replaces each field's own subtotal setting. - A numeric "For empty cells show" caption (Excel stores missingCaption="0") is written as a number in the value's format. - With field headers off there's no Values row, so firstDataRow matches. - A field that isn't auto-sorted keeps its <items> order even when it is cache order (date groups only when reordered). Items tied in a sort by value still break ties by label in the sort direction: over 60 tie groups in the 11 Excel-saved reports no stored order (pivotField items, sharedItems, first appearance, reversed or not) explains more than 21, the same as the current rule.
…te order of date groups - Sort scope entries name their field by source column and date grouping (PivotScopeItem), so Years and Quarters of one date column stay apart when reading, computing and writing. - The engine and the writer resolve a scope the same way: a scope naming an item that's no longer there sorts by the grand total, as it is then saved. - A field with custom subtotal functions (sumSubtotal...varPSubtotal) has subtotals on; it shows the automatic subtotal, with a warning. - Date groups that aren't sorted show in date order, the order of the cache's group items, instead of source order.
…s subtotal default on
…items Excel writes a pivot cache's date items as ISO dates counting real days from 1899-12-30: a time is 1899-12-30T08:00:00 and serial 1 is 1899-12-31. GridCraft read them with DATE() rules, which move year 1899 on to 3799, so those items never matched the report's items. A refresh then put them after every item that did match, such as (blank), and saving wrote that wrong order into the file. ISO dates (pivot cache items, t="d" cells) now go through a calendar-date conversion that counts real days from the epoch, accepts 1900-02-29 as serial 60, and in the 1904 system takes 1899-12-30 as a time's date part. The cache writer uses the inverse, so serial 1 is written as 1899-12-31 as Excel does. DATE() keeps its own rules.
The ascending item order put dates between text and TRUE/FALSE. Excel's item lists put numbers, text, logicals, errors, dates and then blanks: in the one Excel-saved cache in the test corpus whose fields mix dates with logicals or errors (ClosedXML VariousDataTypesInTableColumns), the Mixed Types field lists 10, 14.5, ABC, TRUE, #DIV/0!, 16:30, 8/10/2020, (blank), and the DateTime with num field puts its numbers before its dates. The sort classes follow that order. Also adds the regression test for the time items read from an Excel cache.
The previous commit changed the shared ISO date parser, so worksheet t="d" cells dated before March 1900 also read one day later. The evidence for the real-day convention comes from Excel's pivot caches only, so worksheet cells read exactly as before again. The parser takes the date conversion as a parameter: worksheet cells keep DATE() rules, pivot cache items use the real-day conversion that the cache writer mirrors.
The date sort class came from the number format of the column's first data cell. Excel decides per cell (it caches date-formatted cells as <d> and General ones as <n>), so a General first cell made every date sort as a number, and a date-formatted first cell made General numbers sort as dates. The source now records, per cell, whether its own format is a date, and the class follows that.
Reading every source cell's style made each refresh of a large source much slower. The source now keeps the sheet row of each record, and the per-cell date flags are read only for ungrouped row and column fields, one format lookup per distinct style. One number in a date cell and in a General cell is one item; its sort class depended on which cell came first. Any General occurrence now makes it a number.
… number The General-wins rule ran in item interning, which only sees records that pass the report filter, so filtering out the General cell made its number sort as a date. The date flags are now decided over every record of the column before filtering, as Excel's cache decides.
date_cells hashed every non-date number of a column into the General set even when no cell of the column was a date, which a numeric General row field paid for on every refresh. The set is now built only when some flag is set.
The rowGrandTotals/colGrandTotals fix moved to its own PR at review's request.
With values on rows in Outline or Tabular, the Σ Values column header showed "Values" even when the file sets dataCaption; Excel shows the caption.
Integrate current main into the storytold#722 dependency branch. Explicit source order and changed date grouping discard stored manual ranks; repeated or invalid cache references do not duplicate the imported item order. Cover both axes, Undo/Redo, dependent formulas and XLSX round trips. Co-Authored-By: GPT-6.1 Sol <noreply@openai.com> Co-Authored-By: GPT-6 Astra <noreply@openai.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Preserve the storytold#722 dependency and the source-order, regrouping and XLSX deduplication fixes alongside upstream Show Details guards. Add a synthetic regression covering manual/source order transitions and Show Details records and its disabled state. Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Merge f6b0cec, including main f6b0cec. Preserve the contribution's existing behavior, regression coverage and safeguards. Validation before commit: separate cargo --offline --locked xtask ci, 10/10 gates; 2551 passed, 0 failed, 1 pre-existing ignored. All 12 selected checks passed on tree 81faba9. CI-pinned craft-fonts b076417b5880bd4154bd22f00695b1d28c6bea83, required mode. Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Merge 45f5ab1, including main 45f5ab1. Preserve the contribution scope and safeguards while porting it to upstream module layout. Validation before commit: separate cargo --offline --locked xtask ci, 10/10 gates; 2551 passed, 0 failed, 1 pre-existing ignored. All 12 selected checks passed on tree 3c08422. CI-pinned craft-fonts b076417b5880bd4154bd22f00695b1d28c6bea83, required mode. Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
|
Review notes (comment only; nothing here changes the PR's status). The PR is a draft that carries #722's history, so I looked at what it adds: Read the diff. The reader change is bounded and drops invalid indices rather than indexing ( Checked in real Excel (desktop, COM, a new temporary workbook, closed without saving). A table with Item values b, a, c, a, b, c (so first appearance is b, a, c) and a PivotTable with Item as a row field:
Not checked. I did not get the date-grouping part of Excel to run (my grouping call did not create a Months field), so the claim that regrouping discards the old ranks is not compared with Excel. I did not build or run the tests (12 required checks per the description), and the Show Details and XLSX round-trip parts were read, not run. |
Respond to the reported Excel COM observations using synthetic data only. Documentation only; retain behavior, validation and protection checks. Separate local cargo --offline --locked xtask ci before commit/push: 10/10 gates; 2551 passed, 0 failed, 1 pre-existing ignored. All 12 selected tests passed on tree 7b52e3f. CI-pinned required fonts verified; no GitHub CI execution is claimed.
|
@Harrison-Booth Thank you for the sorting comparison. Clarified the documentation and PR description in 937ca5ce: The note attributes manual/ascending results to your Excel COM checks, and explicitly leaves date regrouping unmeasured in Excel. GridCraft's regrouping behavior has synthetic regression coverage; it is not described as verified Excel parity. This update is documentation only: sorting, cache-reference deduplication and Show Details protections are unchanged. The PR remains a draft follow-up to #722. Separate local macOS We have not independently rerun your Excel COM experiments. |
|
I fetched this head and ran |
…at d5cdd4b Keep the upstream parity descriptions and the pivot order follow-up entry. Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3633 tests passed, 0 failed and 4 ignored.
…idelity # Conflicts: # crates/engine/src/pivot.rs # crates/engine/src/pivot/compute.rs # crates/engine/src/pivot/output.rs
…idelity # Conflicts: # crates/xlsx/src/tests/pivot_tests.rs
Keep source-order reset, regrouping, and cache reference deduplication on the updated dependency. Linux arm64 CI: 10/10 gates passed, 3914 tests passed, 0 failed, 4 ignored.
…idelity # Conflicts: # crates/engine/src/pivot/compute.rs # crates/model/src/features.rs # crates/xlsx/src/tests/pivot_tests.rs # docs/target-app-parity.md
Imported PivotTables can retain obsolete manual ranks after a source-order reset or a grouping change, while repeated cache references can multiply saved ranks. This draft remains a targeted follow-up to #722.
pivot.sortwithorder: "source"clears saved manual ranks;nonepreserves them. Source order is a GridCraft extension, distinct from Excel ascending order.This draft includes #722 at
a05d381c5cbffc5f159cb3dc2b438a7961a4da71, retaining its author history. The integration corrects pivot calculation and test compilation issues in that head and checks GETPIVOTDATA through a source-order reset, undo, refresh and XLSX reopen. This PR remains in draft until its dependency is integrated.Validation — current head (2026-11-17)
76d83a12e02e685acfbdb022ae56f02e457cd69chas the exact tree checked before commit and push. Local Linux arm64 CI passed all 10 gates, with 4,007 tests passed, 0 failed and 5 ignored. The twelve selected pivot and XLSX checks passed, including the extended GETPIVOTDATA regression.Historical validation (2026-11-02)
b56129af215c67653e3745599a62953d2e00f9d0; includes main488f9982ebf05be9bfe581489d0edc6e3918eec7.cargo --offline --locked xtask ci; 10/10 gates, 3020 tests passed, 0 failures, 1 pre-existing ignored test. All 12 selected regression checks were observed passing in the complete run. No tests were excluded.xtaskrebuilt. Source was mounted read-only, its tree was checked against the committed tree, and CI-pinned craft-fontsb076417b5880bd4154bd22f00695b1d28c6bea83were hash-verified and required.