Skip to content

feat(xlsx): pictures and chart placeholders on sheets - #11

Open
mkroemer wants to merge 1 commit into
p10node:mainfrom
mkroemer:xlsx-drawings
Open

mkroemer wants to merge 1 commit into
p10node:mainfrom
mkroemer:xlsx-drawings

Conversation

@mkroemer

Copy link
Copy Markdown

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 in XlsxView.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 call xlsx.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.ts checks 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 test and 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

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>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants