Skip to content

fix(xlsx): keep leading and trailing whitespace in document properties on reopen (#554) - #608

Merged
h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
MarekSpodBiedry:issue-554
Oct 13, 2026
Merged

h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
MarekSpodBiedry:issue-554

Conversation

@MarekSpodBiedry

Copy link
Copy Markdown
Contributor

Fixes #554.

The XLSX reader trimmed the text of the core properties (title, subject, creator, keywords, description) and of Company in docProps/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_whitespace in crates/xlsx/src/tests/roundtrip.rs sets 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 on main and passes with the fix. Unpadded values, empty values and interior whitespace are still covered by the existing sample() round trip.

@MarekSpodBiedry
MarekSpodBiedry marked this pull request as ready for review October 12, 2026 06:53
@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit 51b1b03 into storytold:main Oct 13, 2026
1 check failed
@echelon

echelon commented Oct 13, 2026

Copy link
Copy Markdown
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>
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.

fix(xlsx): reopening trims whitespace from document properties

3 participants