Whether this wrapper still refers to a live engine object.
Body paragraph count.
Word count across the document body.
Character count across the document body.
Laid-out page count (0 until a layout exists — the live GPU path produces one).
The document's caret and selection.
Reference equality is the identity test — prefer a === b. This is retained only for
the rare cross-realm case where two wrappers describe the same handle by value. Reads the
raw index so comparing a stale wrapper never throws.
A readable identity for logs and diagnostics, never [object Object].
The index-th body paragraph, or null if out of range.
Insert text at the caret, replacing any selection.
Toggle one or more character-format bits over the selection (see TextFormat).
Apply a paragraph style to every paragraph the selection touches.
Set the alignment of the paragraph at index directly (see Alignment).
Start a headless find/replace session over the document body. Navigation moves the
selection onto each match. flags bits: 1 = match case, 2 = whole word.
Undo one step; returns whether anything changed.
Redo one step; returns whether anything changed.
Reset the document to a single empty paragraph.
Finalize a batch of authoring operations (mirrors the importer's tail step).
Set a document metadata field (title, author, …) by its engine field ordinal.
Append a new body paragraph with the given alignment and style; returns its wrapper.
Append a formatted run to the last body paragraph; returns the appended byte length.
Resolve a font-family name to its registry id (needs the GPU renderer).
Create a rows×columns table; returns its wrapper.
Add an image from its original encoded bytes (PNG/JPEG); returns the engine image id.
The inline-image controls for the image carried by paragraph.
Add a comment anchored to [start, end) of paragraph; returns its wrapper.
Add a header paragraph with the given alignment; returns its header-paragraph index.
Add a footer paragraph with the given alignment; returns its footer-paragraph index.
Append a run to the last header paragraph (a non-zero field emits a field code).
Append a run to the last footer paragraph (a non-zero field emits a field code).
Skip the header/footer on the first page.
Enable distinct even/odd-page headers and footers.
Load already-inflated .docx parts into the model (word/document.xml, styles.xml, …).
Use this when the host inflated the package itself; DocumentEngine.import does
the inflation for you.
Replace this document's content with an inflated .docx read from encoded bytes.
Export the document. docx and odt work anywhere; pdf needs the GPU renderer.
Render one page offscreen and return it as a PNG Blob. This uses the export/ capture path (the browser encodes the PNG) and never the live view. Needs the GPU renderer; returns an empty blob if nothing was rendered.
Close the document handle and release its wrappers.
A document. Reads are property getters straight off the engine model; navigation returns cached wrappers (
===identity); editing and authoring mutators chain and repaint any attached viewport. The PNG path is thumbnail-only — the live view presents through the WebGPU swapchain, never a pixel readback.