Skip to content

#1447: PivotTables in XLSX open in Excel and keep date groups, report filters and layout - #1538

Closed
HyakoV3 wants to merge 1 commit into
storytold:mainfrom
HyakoV3:fix/1447-pivot-xlsx
Closed

HyakoV3 wants to merge 1 commit into
storytold:mainfrom
HyakoV3:fix/1447-pivot-xlsx

Conversation

@HyakoV3

@HyakoV3 HyakoV3 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Part of #1447 (items 1, 3, 4, 5 and 6 of its list; the issue stays open for 2 and 7).

All in crates/xlsx/src/pivot.rs:

  1. Unopenable file: booleans and errors in the source count as strings in the cache <sharedItems> flags, as Excel writes them. Before, containsString="0" next to them made Excel refuse the file (even with repair).
  2. Report filter: pageField@item is read through the pivot field's <items> (x = shared item), so Qty = 3 is no longer read as another item.
  3. Date groups with a blank date: containsSemiMixedTypes="0" is only written when there is no blank.
  4. Day groups: a date-grouped field is written without sortType (Excel sorted its labels as text) and a date group without sortType reads back as ascending.
  5. Two value fields, no column field: firstHeaderRow="0" plus <x14:pivotTableDefinition hideValuesRow="1"/>, so Excel 365 adds no Values row (no more #SPILL! below the report). One value field is unchanged.

Not in this PR: 2 (source headers with leading/trailing spaces: engine + xlsx header handling) and 7 (PivotChart link needs the file name threaded to the writer). Happy to do them next; they touch other files.

Tests: cache flags for the six column kinds of the issue's table, date-group flags with and without a blank, hideValuesRow, and the report-filter read. The three write-side tests fail on main. The existing round-trip fixture's Years group now uses PivotSort::Asc (the default) since a date group without sortType reads as ascending. cargo xtask ci passes.

Open PRs #722, #474, #498, #719 and #684 touch the same files, so a rebase may be needed.

🤖 Generated with Claude Code

…ainsString="0"

next to them made Excel refuse the file); a date group with a blank date no longer
writes containsSemiMixedTypes; date groups are written without sortType and read back
ascending; a single-item report filter is read through the field's items; two value
fields without a column field write firstHeaderRow=0 and hideValuesRow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@HyakoV3
HyakoV3 force-pushed the fix/1447-pivot-xlsx branch from bbf2e61 to a306ce7 Compare October 16, 2026 00:46
@HyakoV3

HyakoV3 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Split into one PR per item of #1447, as the ticket asked: #1680 (item 3), #1681 (item 4), #1682 (item 5), #1683 (item 6). Item 1 (Boolean/error cache flags) is left out here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant