Skip to content

fix: preserve numeric-looking inline strings#342

Merged
MathNya merged 2 commits into
MathNya:masterfrom
developer0hye:fix/preserve-inline-string-types-v3
Jul 22, 2026
Merged

fix: preserve numeric-looking inline strings#342
MathNya merged 2 commits into
MathNya:masterfrom
developer0hye:fix/preserve-inline-string-types-v3

Conversation

@developer0hye

@developer0hye developer0hye commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve inlineStr cell values as strings instead of guessing their type.
  • Return string and rich-text cells unchanged from formatted_value() instead of applying numeric number-format coercion.
  • Add parser-level regression coverage for a numeric-looking inline string (0050) through both raw and formatted value APIs.

Root cause

The XLSX reader routed inlineStr text through set_value_crate, which guesses scalar types. That converted values such as 0050 to the number 50, losing both the leading zeros and the source cell type. After preserving the raw string type, formatted_value() still passed the text through the number formatter, which again normalized it to 50 under the General format.

The reader now uses the existing set_value_string_crate path, and formatted text values bypass numeric formatting just as Excel text cells do.

Impact

Numeric-looking text stored as OOXML inline or shared strings now remains text through both value APIs. Numeric cells continue to use their number formats.

Validation

  • cargo test (86 library tests, 112 integration tests, 4 streaming-writer tests, and 79 doc tests passed; 23 tests ignored)
  • cargo clippy --lib -- -D warnings
  • cargo +nightly fmt --all -- --check

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye marked this pull request as ready for review July 18, 2026 15:07
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
(cherry picked from commit 6e968e3)
@c-git

c-git commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

I legit had this problem this morning. Thanks. I had some text with leading zeros and my zeros got removed.

@developer0hye

Copy link
Copy Markdown
Contributor Author

@c-git cool

@MathNya

MathNya commented Jul 22, 2026

Copy link
Copy Markdown
Owner

@developer0hye
Thank you for the PR.
Since there were no issues, I’ll go ahead and merge it.

@MathNya
MathNya merged commit 91f28d7 into MathNya:master Jul 22, 2026
5 checks passed
@developer0hye
developer0hye deleted the fix/preserve-inline-string-types-v3 branch July 22, 2026 09:35
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.

3 participants