Skip to content

Preserve editable ink strokes across XLSX saves - #712

Merged
h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
jonathanwxh-cell:fix/xlsx-ink-roundtrip
Oct 13, 2026
Merged

h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
jonathanwxh-cell:fix/xlsx-ink-roundtrip

Conversation

@jonathanwxh-cell

Copy link
Copy Markdown
Contributor

Preserves the ink portion of #551. Draw a stroke, save as XLSX and reopen: previously the stroke became a filled rectangle with point coordinates as its caption, and Ink to Shape could no longer find it. Strokes now retain their path, colour, integer width, anchor and GridCraft editability across repeated saves.

The writer emits standard, unfilled DrawingML polylines with explicit line styling and no private metadata. The reader accepts only a bounded subset the current Ink model can represent; curves, multiple/closed paths, fills, transforms, captions and unsupported line styles stay on the existing fallback. It validates an entire path before converting it and caps strokes at 20,000 points. Signed and fractional points, zero-axis strokes and highlighter opacity at the default scale are covered.

This is editable polyline geometry, not native Office InkML. Icons remain a follow-up, so this does not close #551. #685 changes the same drawing reader for grouped shapes; this patch adds a separate helper and a small call site.

Validation on Windows x64 / Rust 1.99.0, baseline 85bfcdf:

  • Nine new tests on unchanged production code: six failures, three passing controls.
  • Patched: all nine new tests passed; all 138 XLSX tests passed (cargo test -p gridcraft-xlsx --locked and cargo test -p gridcraft-engine --test ink_roundtrip --locked).
  • Synthetic workbook passed the existing CLI package check: no dangling relationships or missing content types. The checker does not compare ink; the new tests cover that.
  • Offscreen GridCraft render at 1100 x 700, default scale: purple freehand path and translucent green highlighter retained after save/reopen; no point-text captions.
  • cargo xtask ci: all eight gates passed (formatting, Clippy with warnings denied, full workspace tests, assets, layering, WebAssembly, parity and keytips).

External Excel rendering and repair-free opening have not been observed. Unsupported custom shapes retain the existing fallback; this PR does not add a general custom-geometry renderer. Prepared with AI assistance, independent test authorship and a separate agent's code review.

DrawingML references: Path, MoveTo, Outline.

jonathanwxh-cell and others added 2 commits October 12, 2026 23:54
# Conflicts:
#	ROADMAP.md
#	crates/xlsx/src/tests/mod.rs
#	docs/file-format-parity.md
#	docs/gaps.md
@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit a8cb5fe into storytold:main Oct 13, 2026
@echelon

echelon commented Oct 13, 2026

Copy link
Copy Markdown
Member

Merged — thank you @jonathanwxh-cell for the contribution!

I merged main into your branch to resolve conflicts with other PRs that landed first.

If you haven't already, come join us on Discord: https://discord.gg/artcraft

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.

fix(xlsx): saved icons and ink strokes reopen as rectangles

3 participants