Repository navigation
feat(xlsx): pictures and chart placeholders on sheets - #11
Merged
Merged
Conversation
A sheet's drawing part (xl/drawings/drawingN.xml) is read for its pictures and charts with their anchors: two cells, one cell and a size, or a position and a size. The new `xlsx.drawings(sheet)` call returns them; the grid lays them over the cells, placed by the row and column axes, so a picture moves and grows with resized or hidden rows and columns, and the sheet extends far enough to reach every drawing. A picture the browser can draw (PNG, JPEG, GIF, SVG, ...) is shown as itself, through the client's media URLs. A chart, and a picture in a format the browser cannot draw (EMF, WMF), is shown as a box of its size naming what is there: the chart's kind (column, bar, line, pie, ...) and title. Shapes and text boxes are left out. Clicks go through to the cells below. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pierreneter
approved these changes
Nov 17, 2026
pierreneter
left a comment
Member
There was a problem hiding this comment.
Thank you, pictures on sheets are a welcome addition.
Approved. Typecheck and unit tests pass, and it merges cleanly together with #4, #5, #13 and #16. I checked the relationship handling against the recent fix for remote requests: external, absolute, //host, ../ and data: targets never become a URL, r:link is ignored, and SVG media is a blob in an <img>.
Follow-ups, none blocking:
- An anchor row such as
3999999998extends the row axis to 4e9 and the grid hangs.mainalready hangs the same way on<row r="4000000000">, so that one belongs tomainand not to this PR; clampingcorner()insrc/core/xlsx/drawings.tsto 1,048,576 rows and 16,384 columns would still be right. - A group shows only its first picture, stretched over the whole group; crop and rotation are ignored.
- Every picture is fetched on sheet open, also the ones off screen.
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.
This shows the pictures on a spreadsheet's sheets, and puts a labeled box where a chart is. It is independent of the UI PRs (#4 to #10) and based on
main; whichever lands second needs a small rebase inXlsxView.tsx, which I'll do.A sheet's drawing part (
xl/drawings/drawingN.xml) is read for its pictures and charts with their anchors: two cells, one cell and a size, or a position and a size. The new worker callxlsx.drawings(sheet)returns them, and the grid lays them over the cells, placed by the row and column axes. So a picture moves and grows with resized or hidden rows and columns, and the sheet extends far enough to reach every drawing.A picture the browser can draw (PNG, JPEG, GIF, SVG, ...) is shown as itself, through the client's media URLs. A chart, and a picture in a format the browser cannot draw (EMF, WMF), is shown as a box of its size naming what is there: the chart's kind (column, bar, line, pie, ...) and its title. Shapes and text boxes are left out. Clicks go through to the cells below.
test/xlsx-drawings.test.tschecks that a sheet lists its pictures and charts with their anchors and leaves shapes out, and that a drawing placed by its cells moves and grows with them.bun run typecheck,bun testand the e2e suite pass in CI.A follow-up PR draws the charts themselves as SVG in place of the placeholder.
🤖 Generated with Claude Code