Repository navigation
Conversation
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.
Summary
Fixed issue where a numeric cell in an xls file was read as a date when its number format was stored in a Format record with an id from 50 to 58.
parse_format()only accepted theifmtranges listed in MS-XLS and dropped the record for any other id. The cell then fell back to the built-in format with that id, and 50 to 58 are the East Asian date formats. The format string of a Format record is now used for any id, so it takes precedence over the built-in format, the same way an explicitnumFmtalready does for xlsx.XlsError::InvalidFormatis no longer returned. I left the variant in place because removing it would change the public API.Related issue
Fixes #798
Testing
Added
tests/format_id_overrides_builtin.xlsandtest_xls_format_id_overrides_builtin. The file is thefix50.xlsattached to the issue, unchanged. The issue describes how it was made: an xlsx written with openpyxl, converted to xls with LibreOffice, then the Format and XF records patched so the two custom formats use ids 50 (0.000) and 51 (0.0).Without the change the test fails with
DateTime(3.505)instead ofFloat(3.505).Checklist
cargo test --all-featurespasses.cargo fmt -- --checkpasses.cargo clippy --all-targets --all-features -- -Dwarningspasses.Other information
I also ran
cargo +1.89 check --all-features. I did not run the wasm check ortyposlocally.