Skip to content

#1447: pivot source headers keep their spaces; PivotChart link names the workbook - #1546

Closed
HyakoV3 wants to merge 2 commits into
storytold:mainfrom
HyakoV3:fix/1447-pivot-headers-chart
Closed

HyakoV3 wants to merge 2 commits into
storytold:mainfrom
HyakoV3:fix/1447-pivot-headers-chart

Conversation

@HyakoV3

@HyakoV3 HyakoV3 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Items 2 and 7 of #1447. Stacked on #1538 (items 1, 3–6, same file): review the last commit only; I'll rebase and mark this ready when #1538 merges. With both, #1447 is complete.

  1. Headers with leading/trailing spaces: the pivot source (engine/src/pivot.rs) and the cache (header_text) keep a header as it is, as Excel does; only an all-blank header is an error / ColumnN. Source::col matches the exact header (case-insensitive) first, then a trimmed comparison when exactly one header matches, so a command naming Region still finds Region . Before, the fields vanished on open + save and on refresh.
  2. PivotChart: the chart link is written as [Book.xlsx]Sheet2!PivotTable1; Excel only binds the chart to its PivotTable behind a bracketed workbook. New gridcraft_xlsx::write_xlsx_named carries the file name to write_chart (save_bytes_as passes the path's file name; file.saveBytes the document's name); [Workbook.xlsx] when unknown or when the name holds [ / ]. The reader drops the bracket prefix, so the model link stays Sheet2!PivotTable1.

Tests (crates/engine/tests/pivot_headers_and_chart_link.rs, both fail on main): a pivot over Region / Sales keeps 1 row and 2 value fields through create, XLSX save, reopen and refresh; the saved chart holds [Q1 Report.xlsx]Sheet2!PivotTable1 and reads back as Sheet2!PivotTable1. cargo xtask ci passes.

🤖 Generated with Claude Code

@HyakoV3
HyakoV3 force-pushed the fix/1447-pivot-headers-chart branch from 62f6cae to 5378d4f Compare October 16, 2026 00:38
@HyakoV3
HyakoV3 marked this pull request as ready for review October 16, 2026 00:39
HyakoV3 and others added 2 commits October 15, 2026 21:39
…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>
…nk names the workbook

A header with a leading or trailing space is kept as it is in the pivot source and
cache, and a command naming Region still finds 'Region ' when it is the only match.
A PivotChart's link to its PivotTable is written behind the workbook in brackets
(file name, or Workbook.xlsx when unknown), so Excel binds the chart to the table.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@HyakoV3

HyakoV3 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Split into one PR per item of #1447: #1684 (item 2, header spaces) and #1685 (item 7, PivotChart link).

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