Repository navigation
fix(web): improve Word document previews - #34722
Conversation
- Render document fonts and fall back to system fonts for missing glyphs - Load SVG pictures in Word previews
|
This PR changes the test suite by +4 test cases (browser +3, unit +1, server 0). New browser test files: Keep tests that would fail for a real reason, and test logic below the UI where it can be. See Testing. |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Improves Word previews for missing glyphs, embedded vector pictures, and list bullets while sharing PowerPoint’s rasterizer. Effects remain confined to temporary previews, with source documents unchanged and existing resource safeguards retained. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
Co-authored-by: Cursor <cursoragent@cursor.com>
Problem
Word document previews can omit or misrender content such as metafile images, text without a bundled font, and list bullets. The preview also lacks layout improvements available in newer versions of the DOCX engine.
Change
Upgrade
@betteroffice/docxto 0.5.1 and update the lockfile and third party license configuration. Move document opening and rendering into a testable module. Add fixes for missing glyphs, document fonts used for list labels, SVG picture rendering, and picture bullets that otherwise invalidate numbering data. Share the SVG rasterizer with the PowerPoint preview.The engine upgrade also improves columns, text boxes, page borders, and table style formatting. Corpus comparisons identified two rendering regressions and other remaining engine gaps; those are listed in the change report for upstream follow-up.
Scope and approval
This is a focused fix to the existing Word preview. It addresses the preview problems reported for this branch without adding a new user workflow.
Verification
vp run check:changedpassed, as did the Office browser suites with 149 tests. A production build worker rendered every page of 12 documents without worker errors. Corpus comparisons covered 67 DOCX files against LibreOffice and the 0.4.3 preview. Small-document open times stayed within 10–20 ms of the previous version. A 177-page document opened about 10% slower and painted all pages 2.2 times faster. The full app was not tested in a browser.