Repository navigation
XLSX: keep a dxf's protection, font size and face, and the font parts it turns off - #1225
Merged
aiongg merged 1 commit intoOct 22, 2026
Merged
Conversation
… it turns off (part of storytold#1209)
Contributor
|
Tested together with #1221 on the real workbook: protection, the font parts turned off and |
Contributor
Author
|
Awesome, thanks for running both again @richard1912, really appreciate it 🙌 |
aiongg
added a commit
to aiongg/gridcraft
that referenced
this pull request
Oct 22, 2026
Schema order is font, numFmt, fill, alignment, border, protection.
aiongg
added a commit
to aiongg/gridcraft
that referenced
this pull request
Oct 22, 2026
…and family on save crates/xlsx/src/styles.rs: family/charset block ported into the dxf.is_none() branch of font_xml (PR storytold#1225 made it take Option<&DxfStated>) docs/file-format-parity.md: header Change line keeps both sides' clauses
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.
Part of #1209.
The shared dxf writer (
<dxfs>instyles.xml) dropped a differential format's<protection>, leaving an empty<dxf/>, never wrote the font'sszandname, and only wrote the font parts that were turned on, so<b val="0"/>,<i val="0"/>and<u val="none"/>were lost. A header dxf that turns bold off lost it, and the table style made the header bold again.A dxf's
Stylereads its default parts as unset, so "bold off" or "locked, not hidden" can't be told from "not stated". The reader now records those in a smallDxfStatedonStyle, only where the stated value matches the default (empty for cell formats and for formats made in the app), and keeps a stated face and size in the font. The writer writes them back, along withscheme. Nothing that renders conditional formats or tables reads the new field.Thanks @richard1912 for finding these while testing #1221 on a real workbook.
Validation:
fixtures::dxf_font_and_parts_stated_at_their_defaults_survive_save: four dxfs (font parts turned off, size/face/scheme at their defaults, a default protection, a non-default one, a non-default size and face), checked against the<dxfs>written on save. Fails on main (<dxfs count="2"><dxf></dxf><dxf><font><b/></font></dxf>), passes herecargo test -p gridcraft-xlsx --lib -- tests::fixtures tests::roundtrip,cargo test -p gridcraft-engine --lib -- cf::cargo clippy -p gridcraft-model -p gridcraft-xlsx -p gridcraft-engine -p gridcraft-ui-egui --all-targets -- -D warnings,cargo fmt --all -- --check