Document lifecycle
open
Open a document from a file, URL, or buffer.
string | File | Blob | Buffer
Document source. Omit for a blank document.
OpenOptions
This is the instance method. For one-liner creation, use the static
Editor.open() factory β see Configuration.close
Close the current document. The editor instance stays alive for reuse.
save
Save back to the original source path (Node.js only).
SaveOptions
saveTo
Save to a specific path (Node.js only).
string
required
File path
exportDocument
Export as a Blob (browser) or Buffer (Node.js).
exportDocx
Lower-level export with additional control.
Returns: Promise<Blob> in the browser, Promise<Buffer> in headless/Node.js mode.
Object
replaceFile
Replace the current DOCX with a new file.
Content
getHTML
getJSON
getMarkdown
replaceContent
Replace the entire document content.
replaceNodeWithHTML
Replace a specific node with HTML.
Editor control
mount / unmount
destroy
Permanently destroy the editor.
focus / blur
setEditable
setDocumentMode
Commands
All commands are accessed viaeditor.commands:
insertContent
Insert content with automatic format detection.
string | Object
required
Content to insert
Object
HTML and Markdown inline styles are stripped on import to ensure Word compatibility.
Document metadata
getMetadata
getDocumentIdentifier
Get a stable identifier (GUID or content hash).
isDocumentModified
Schema
getSchemaSummaryJSON
Generate a summary of the document schema. Useful for AI agents that need to understand the document structure.
Position & coordinates
getElementAtPos
Get the DOM element at a document position.
number
required
Document position

