Repository navigation
fix(xlsx): keep leading and trailing whitespace in document properties on reopen (#554) - #608
Merged
Merged
Conversation
Member
|
Merged — thank you @MarekSpodBiedry for the contribution! |
CouchRiv
added a commit
to CouchRiv/gridcraft
that referenced
this pull request
Oct 13, 2026
Resolves the conflicts with storytold#608 (now merged): both round-trip tests are kept, and storytold#608's `DocProps { … }` literal gets `..Default::default()` for the new fields. In docs/file-format-parity.md both revision rows are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #554.
The XLSX reader trimmed the text of the core properties (title, subject, creator, keywords, description) and of
CompanyindocProps/app.xml. The writer emits these values exactly, and the XML parser is already configured to keep boundary text (trim_text_start/trim_text_end = false), so the trim was the only step that changed them. A title like" Title "came back as"Title", a subject of just"\n"came back empty, and saving the reopened workbook wrote the shortened values.Change in
crates/xlsx/src/read.rs: read the element text as-is for all six fields (no.trim()).Test:
doc_props_keep_boundary_whitespaceincrates/xlsx/src/tests/roundtrip.rssets all six fields to padded values (spaces, tabs, a lone linefeed, leading/trailing linefeeds with indentation), writes and reopens the workbook, and asserts the properties are equal. It fails onmainand passes with the fix. Unpadded values, empty values and interior whitespace are still covered by the existingsample()round trip.