Skip to content

Charts: keep the embedded workbook when a chart is saved unchanged (#335) - #355

Merged
h-a-n-a-s-h-i merged 5 commits into
storytold:mainfrom
NikitkaRa:fix/pptx-chart-workbook
Oct 14, 2026
Merged

h-a-n-a-s-h-i merged 5 commits into
storytold:mainfrom
NikitkaRa:fix/pptx-chart-workbook

Conversation

@NikitkaRa

@NikitkaRa NikitkaRa commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Saving a .pptx dropped every chart's embedded workbook (ppt/embeddings/) and the chart part's relationships, even when the chart itself was unchanged. The file still rendered, so the loss showed up only when someone tried to edit the chart data in PowerPoint.
  • An unchanged chart now keeps that workbook, the chart relationships, and the other parts those relationships reach (styles, drawings). Editing the chart still omits the workbook, so a stale spreadsheet is not written next to new cached values.
  • About: real name Nikita Rakitin for @NikitkaRa.

Fixes #335

Test plan

  • cargo test -p deckcraft-pptx --test chart_embed — workbook bytes, chart rels and c:externalData survive import → export; an edited chart writes neither
  • cargo test -p deckcraft-pptx --lib --test roundtrip --test ole
  • cargo clippy -p deckcraft-pptx -p deckcraft-model --all-targets -- -D warnings
  • The issue's public repro files, Apache POI test-data/slideshow/pie-chart.pptx and radar-chart.pptx: import → export keeps ppt/embeddings/Microsoft_Excel_Worksheet1.xlsx byte for byte, keeps ppt/charts/_rels/chart1.xml.rels pointing at it, and keeps c:externalData. A second save of that output still matches. Not opened in PowerPoint.
  • Open a chart deck in PowerPoint after saving it in DeckCraft and confirm Edit Data still works

Nikitkao and others added 5 commits October 13, 2026 10:40
…torytold#335)

PowerPoint stores chart data in ppt/embeddings. Saving used to drop that part and the chart relationship, so the deck still rendered but the workbook was gone. An edit still omits the workbook rather than writing numbers that no longer match it.

Co-authored-by: Cursor <cursoragent@cursor.com>
…torytold#335)

A chart relationship must not be able to replace a slide or another package part when the deck is saved.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
# Conflicts:
#	ROADMAP.md
#	crates/pptx/src/read/chart.rs
#	docs/gaps.md
@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit b6a4343 into storytold:main Oct 14, 2026
h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 14, 2026
…book

A chart's kept parts were written under the names the source file gave them,
so a relationship to ppt/media/image1.png (or any name the writer generates)
produced a second zip entry with that name on save. Kept parts are now written
as ppt/<folder>/keptN.<ext> with a content-type override each, the chart's and
the kept parts' own relationships are rewritten to the new names (relationships
to parts that were not kept are dropped), and the package writer skips any
second entry under a name it already wrote. externalData/userShapes are dropped
only when their relationship is not written back.

Office 2016 chartex charts (added on main since the PR) capture and write back
their kept parts the same way; the plain-chart fallback carries none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 14, 2026
# Conflicts:
#	crates/engine/src/cmd/mod.rs
#	crates/ui-egui/src/ribbon.rs
@echelon

echelon commented Oct 14, 2026

Copy link
Copy Markdown
Member

Thank you for this contribution, @NikitkaRa! It has landed on main and will ship in the next DeckCraft release.

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

pierrevbc added a commit to pierrevbc/deckcraft that referenced this pull request Oct 15, 2026
Main keeps an unchanged chart's embedded workbook (storytold#355), but a chart made
in DeckCraft, or one whose data or options changed, was written with no
workbook: no part under ppt/embeddings/, no package relationship, no
c:externalData. PowerPoint's Edit Data had nothing to open.

- Export: an unchanged chart still goes back with its kept parts; an
  edited or new chart gets a workbook generated from its data, laid out
  where the chart part's formulas point (Sheet1, categories in A, one
  column per series), with its c:externalData.
- Scatter series with different X values and multi-series bubble charts
  get their own columns instead of overlapping ranges.
- ChartKept::workbook finds the kept workbook part.
- The plain-chart fallback of an Office 2016 chart gets none: the
  workbook belongs to the chartEx part.
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
* M5.7: update image signatures live during resize and movement

* M5.7: preserve image signature proportions when resizing corners

---------

Co-authored-by: Brandon Thomas <echelon@gmail.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…rogress bar (storytold#370)

* M11: Optimize PDF and Reduce File Size run in the background with a progress bar

Advanced optimization and Reduce File Size did all their work on the UI
thread, so on a large file the window stopped repainting until they were
done and looked as if it had crashed.

- pdfcraft-optimize: optimize_with_progress reports each image and the
  clean-up; returning false stops with OptimizeError::Cancelled.
- engine: Session::optimize_job captures a copy of the document and the
  choices; OptimizeJob::run reports each OptimizeStage (removing user data,
  images, cleaning up, merging, writing), stops on request with
  EditError::Cancelled and turns a panic into an error so a worker always
  reports back. optimized_bytes is the job run in place.
- ui: both commands run the job on a worker thread (inline in tests and on
  the web), like OCR and Export. A card at the bottom centre shows the
  stage ("Optimizing... image 14 of 40"), a bar that eases towards the
  fraction with a light sweeping across it, the percentage and Cancel;
  notices stack above it. A second run is refused while one is going. The
  control channel's state includes the progress.

The headless doc_optimize and doc_reduce tools stay synchronous. New
strings are translated for es, fr, ja, zh-hans, zh-hant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Clippy: as_chunks in the signature image background test (follow-up to storytold#355)

storytold#360 switched the image test to as_chunks; storytold#355 added another chunks_exact(4)
in the background test, which clippy's chunks_exact_to_as_chunks rejects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Optimize: report a failed worker spawn instead of waiting forever

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…ge (storytold#366)

* Text: find the word and the line around a glyph

PageText gets word_at(i) and line_at(i). Each returns the first and
last glyph of the word or the line around glyph i, or None when i is
past the end of the page's text. A word stops at a word gap, a blank
glyph or a line end. A line is the run of glyphs with the same line
number.

The canvas's double-click used its own loop for this, which indexed the
glyph, line and gap arrays directly. It now calls word_at, which reads
them with get(). Double-clicking selects the same words as before.

Test: render words_and_lines_around_a_glyph, on two lines with a blank
glyph, a word gap and a line break.

* Issue storytold#295: three clicks select the line, four clicks the page

With the Select tool, quick clicks on text widen the selection like
Acrobat: two clicks select a word (as before), three the line, four or
more all the text on the page. A third click used to clear the
selection.

egui counts only up to triple clicks and reports a fourth quick click
as another triple, so the view keeps its own count of the current run.
A single click resets it and a pause ends it.

With the markup tools (Highlight and the like) and Redact, a
double-click already turns the word into a mark at once. They stop at
the word, so more clicks don't stack line or page marks.

Tests: ui-egui quick_clicks_select_a_word_then_the_line_then_the_page
and quick_clicks_with_the_highlighter_mark_only_the_word.

parity: view.text-select cites the tests. The notes say what is
missing: paragraph selection, and Ctrl/⌘+A across the whole document
(it selects the current page).

* Clippy: as_chunks in the signature preview test (follow-up to storytold#355)

Clippy 1.99 rejects chunks_exact with a constant chunk size
(chunks_exact_to_as_chunks), so `cargo clippy --workspace --all-targets
-- -D warnings` fails on main since storytold#355. Use as_chunks, as storytold#360 did
for the test above it.

---------

Co-authored-by: Brandon Thomas <echelon@gmail.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…RP ARM64 crash) (storytold#395)

The image-signature tests (storytold#335, storytold#355) render pixels in parallel; on the
Windows 11 ARM64 runner WARP's pixel-shader JIT then crashes the test process
with STATUS_ACCESS_VIOLATION (3 of the last 4 main runs). Take the same GPU
lock tests/view.rs uses (d341651) in every fill_sign test that renders.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
A drawn Fill & Sign signature is an Ink annotation, and Ink couldn't be
resized: the Select tool showed no handles and the engine refused
ResizeAnnotation ("Ink comments can't be resized"). Typed and image
signatures (stamps) already resize (storytold#335, storytold#355), so drawn ones were the
gap left in storytold#331.

- annot: set_rect scales an Ink annotation's strokes into the new
  rectangle, keeping each side's margin between the strokes and /Rect
  so the line isn't clipped, and regenerates the appearance. A straight
  stroke with no extent on one axis is centred on it.
- ui-egui: Ink is resizable with the 8 handles. A drawn signature's
  corners keep its shape, as image signatures' do; other drawings resize
  freely like shapes.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
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.

Saving a .pptx silently drops the embedded workbook behind every chart

4 participants