Screenshots and visual inspection

Validate results with structured readback, rendered screenshots, and slide layout checks.

Visual inspection turns content models into images and layout evidence that can be checked. An Agent first validates data and formulas, then checks rendered text, shapes and pages. It can fix issues through Facades and verify the new content state again.

Three kinds of evidence

EvidenceWhat it can establish
Structured readbackRaw values, formulas and results, paragraphs and object properties.
PNG screenshotVisible content, clipping, charts, colors and overall composition.
Layout diagnosticsRules, object IDs, bounds and issue locations derived from rendering for targeted fixes.

Prepare content state and dependencies

Screenshot and Layout Lint accept materialized UnitData; they do not connect to remote targets or interpret changesets. For collaborative content, call pull(), await calculation after formula edits, then exportUnitData(). Export the correct draft for a Worktree. Applications can record the target, revision and scope with the report to identify exactly what was reviewed.

A host Snapshot does not include every dependency. Supply Sheet/Relational Table sources through formulaReferenceUnits and child content through embeddedUnits. The Render Page materializes dependencies before the host so formulas and blocks have their sources available. UUID image assets can be prepared with resolveUnitScreenshotImageAssets() and an application resolver; resolution is best-effort, so check missing resources too.

From content to a stable image

100%

univer-render-runtime hosts an application-built Render Page and starts a browser from Node.js. Product plugins restore the content, and both sides check the page protocol version. Operations enter one serial queue per Runtime, allowing reuse across inspection rounds. Its owner eventually calls close().

Readiness is product-specific. Formula-driven Shapes wait until results leave pending and, where needed, until pixels remain stable across frames, avoiding intermediate animation. Relational Table waits for fonts, calculation, the active table/view and stable DOM/Canvas layout. A non-pending formula result can still be an error: verify its value and status.

The current implementation hashes serialized host UnitData, formula sources and embedded children into a rendering session key. Changed content receives a new key even when the Unit ID stays the same, preventing stale-image reuse based only on identity.

Choose the scope by product

ProductScope and output
SheetSelect a worksheet and A1 range for a region PNG. Explicitly select important results.
DocSelect or enumerate pages for individual PNGs.
SlideSelect 1-based page numbers or page IDs; optionally add a contact sheet.
Relational TableCapture the opening active table/view workbench using browser DOM + Canvas.
CanvasesUse content bounds, or mutually exclusive region / elementIds selectors, with optional padding and layout evidence.

unit-screenshot returns image bytes, dimensions, page/range identity and suggested names; the application saves them. Scale accepts 0.1–4. Configure maxPages and per-image maxPixels; doubling scale produces roughly four times as many pixels. Inspect large content in regions. PDF is outside this five-product screenshot entry.

Share rendering for screenshots and lint

The example captures and lints the same Slide data and formula sources. renderRuntime is an existing render Runtime and slideData is the prepared snapshot. These capabilities do not write files. See AI SDK visual inspection for page construction and resource cleanup.

TypeScript
import { createUnitScreenshot } from '@univer-cli/unit-screenshot'import { createUnitLayoutLint } from '@univer-cli/unit-layout-lint'const source = {  unitType: 'slide' as const,  unitData: slideData,  formulaReferenceUnits,}const screenshot = createUnitScreenshot({ runtime: renderRuntime })const lint = createUnitLayoutLint({ runtime: renderRuntime })const capture = await screenshot.capture({  ...source,  target: { kind: 'slide-pages', pages: [1], scale: 2 },})const report = await lint.lint({ ...source, pages: [1] })

Slide: locate problems using glyph ink

Layout Lint uses browser-generated layout facts. An element's declared box describes its model geometry; text ink describes actual glyph bounds mapped into page coordinates with layout, alignment and rotation. A text box fitting on the page does not prove its glyphs fit.

Current ruleEvidence checked
text-off-pageActual text ink extends beyond the page.
text-escapes-containerText visibly escapes a matched, smaller opaque container.
text-overlaps-textTwo actual text ink areas significantly overlap.

Reports include coverage.pages and coverage.rules. A finding carries pageId, element id, text.ink and relevant overflow, container or other evidence. A stable fingerprint helps compare repair rounds. Findings are currently warnings for review alongside screenshots; an empty list only means the selected scope triggered none of these rules.

Canvases: inspect rendered connector routes

Canvases screenshots also return layoutAnalysis with browser-resolved routes, issues and a summary. This is separate from the Slide-only unit-layout-lint capability. Automatic connector paths can be unresolved in the model; use evidence with source: 'rendered' to inspect final routes.

Diagnostics can identify connectors crossing elements, intersections, arrowhead collisions and label conflicts, with connectorIds, elementIds and focusBounds. Fix the relevant objects, capture a region or element set, then review the full canvas. The evidence maps a visual concern to a specific Facade edit.

Include evidence in the handoff

100%

Keep structured results, scope/page information, images and diagnostics together. A screenshot does not establish formula correctness, and lint does not replace visual judgment. Verify complete toolbar, focus and popup interactions in the Web editor, and ensure cross-Unit dependencies were loaded.

Run the checks before marking a Worktree Ready so reviewers can match content changes to evidence. See headless and server calculation for execution and Agents and automation for orchestration.

Back to features

How is this guide?

© 2026 DreamNum Co., Ltd.