Repository navigation
XLSX: keep header and footer pictures on save - #1600
Merged
aiongg merged 1 commit intoOct 22, 2026
Merged
Conversation
jesusthehelper-oss
added a commit
to jesusthehelper-oss/gridcraft
that referenced
this pull request
Oct 19, 2026
# Conflicts: # docs/file-format-parity.md
This was referenced Oct 31, 2026
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 #1257.
Excel stores header and footer pictures (
&Gin the header text) in a VML drawing of their own, which the sheet names with<legacyDrawingHF>, plus the images that drawing points at. The XLSX pass-through (#333) only looked for<legacyDrawing>, so on save the&Gcodes stayed in the header text but the element, the VML part and the images were dropped, and the letterhead was gone the next time the file was opened in Excel. This keeps that drawing and its images byte for byte with the rest of the sheet's kept content, and writes<legacyDrawingHF>back in schema order right after<legacyDrawing>. A sheet with a note and a header picture keeps both drawings separate, and the notes drawing GridCraft writes now takes VML shape blocks after the ones the kept header drawings use, so the two can't end up with the sameo:idmapblock and shape ids.What's left of #1257: GridCraft still doesn't show header/footer pictures in print preview or Page Layout, and can't insert new ones. That's a bigger piece (rendering plus an Insert Picture flow in the header editor), so this PR only stops them from being lost on save. Opening such a file adds a "not shown; kept for saving" note like the one for embedded objects, happy to drop it if it's too noisy.
Validation:
passthrough_tests::header_and_footer_pictures_survive_a_save(header logo + footer picture + a note, saved twice): fails on main (no <legacyDrawingHF>in the saved sheet), passes herepassthrough_tests::notes_take_shape_blocks_the_header_pictures_dont_use: on the first fix alone the notes reused block 1 (notes reuse shape block 1), passes herecargo test -p gridcraft-xlsx --lib -- passthrough roundtrip malformed,cargo clippy -p gridcraft-xlsx --all-targets -- -D warnings,cargo fmt --all -- --check