Skip to main content
Import from @reductoai/docx/node. It gives a WordDocument that reads and writes files and renders with the fonts on the machine.

Open, edit, save

save always needs a path. OfficeJS never writes over the input file by itself.

Create a new document

Bytes in, bytes out

When the document comes from a request or a bucket, use bytes:

Render

Both render the current edit state. You do not need to save first. See PDF and PNG.

Read what is on a page

readPage gives a short text sketch of one laid-out page. It is useful for checks and for LLM agents.

Common tasks

insertText("\n") makes new paragraphs. For a line break inside a paragraph, use insertBreak("Line").