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.
I picked up #280 because ordinary filenames can make an exported workbook lose its pictures in Excel. I used a real Excel open as the acceptance check and kept the change in the XLSX writer, where the image bytes and the references to them are put into the package.
The writer gives pictures whose filenames contain spaces an available internal part name and writes each relationship and its media bytes together. It uses both the filename and the image contents to keep separate images from sharing a part, even after opening a saved workbook and adding a new picture with an existing part's name. The original name remains on the drawing. After reading the file,
Image::image_name()reports the internal part name, as it does for other embedded images.Verification
my image.png. The repaired file showed a broken picture. With the patch, the workbook generated from the same input opens directly and shows the image.my image.png,my%20image.png, andmy_image.pngopened in Excel after a library read and write. All three pictures displayed, and the ZIP relationship targets resolved to the expected bytes. The final patch produces the same drawing and media parts as those Excel-checked files.image1.png, adding a same-named image after reopening a generated file, and a name already used by a lazily copied sheet. A streaming check exercised both write orders. The existingaaa.xlsmfixture retained all 11 drawing, VML, and worksheet image relationships and seven media payloads.cargo test --all-featurespassed 432 tests, including 80 doctests, with 23 ignored. Clippy with-D warningsand the nightly formatting check passed.Fixes #280