Repository navigation
XLSX: strip _xlpm. from LET/LAMBDA parameters on read, keep line breaks in table columns, allow leading backslash in table names - #423
Merged
Conversation
… breaks in table columns, allow leading backslash in table names Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 11, 2026
Merged
h-a-n-a-s-h-i
pushed a commit
that referenced
this pull request
Oct 11, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Merged — thank you for the contribution! If you haven't already, please join our Discord: https://discord.gg/artcraft |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Three XLSX round-trip losses, all in
crates/xlsx:_xlpm.LET/LAMBDA parameters. Excel stores LET/LAMBDA parameter names as_xlpm.namein the file. The writer already adds the prefix, butread_formula(sheet_read.rs) used the raw<f>text, so a savedLET(x,1,x+1)came back as_xlfn.LET(_xlpm.x,1,_xlpm.x+1). Cell, shared and array formulas now go throughfmla::from_file, the conversion CF, data validation and names already use. When the formula parses, the stored text is the parser/printer form with_xlfn./_xlpm.removed. When it doesn't parse, the text is kept as written. One side effect: cell formula text read from a file is now in printer form (for example, spacing may change) rather than byte-for-byte as stored.table_columns(sheet_write.rs) replaced\r/\nwith spaces in column names. Excel allows a line break in a table header, and the header cell still had the break, so the column name and its header cell disagreed after a save. The name is now written unchanged (XML escaping already handles it).table_nameturned a leading\into_(or fell back toTableN). Excel's rules for names in formulas allow a name to start with a letter,_or\, so\_Prime.1is now kept. Structured references such asCOUNTA(\_Prime.1[Name])already parsed.Tests
tests::roundtrip::let_lambda_parameters_drop_xlpm_on_read: LET, an immediately called LAMBDA and an array MAP/LAMBDA formula are written with_xlpm.in the sheet XML and read back with bare parameter names.tests::roundtrip::table_newline_column_and_backslash_name_survive: a table named\_Prime.1with aHandle\nBarscolumn keeps both after a round trip, along with the header cell value and a structured reference formula to it.Commands run:
Before this change, the
gridcraft-cli checkround trip (#416, not needed by this PR) reported 3 of 41 local corpus files differing after a save. With the change, it reported 0. That was measured on an older base, before rebasing onto current main.Docs
docs/file-format-parity.md: header and a history row for this change. The header and the history table overlap other XLSX PRs that touch this file, so a rebase may be needed.Not done
Unverified: needs confirmation in Excel
tableColumn@name, without a repair prompt. The header cell and the column name now match, which is what Excel itself writes, but this has not been opened in Excel.\intable@name/displayName.