DOCX OOXML icon

DOCX OOXML

Create OOXML documents using docx.js with high-level support

Create Document

AI-generated

Summary

Create a new DOCX document from structured content defined either by the incoming input data or a custom JSON structure, with configurable metadata and output format.

Inputs

  • Document Title — Title of the document to include in the document metadata.
  • Document Creator — Name of the creator or author to include in the document metadata.
  • Content Source (required) — Choose whether to use structured data from the input items (inputData) or a user-provided custom JSON (customJson) as the source of the document content.
  • Content JSON (required) — If 'Custom JSON' is selected as Content Source, provide the JSON structure defining the document content, including sections, paragraphs, headings, and formatting.
  • Output Format (required) — Select the output format of the generated document: binary DOCX file, raw OOXML XML parts, Base64-encoded string, or buffer object.
  • Binary Property Name (required) — If output format is binary, specify the name of the binary property where the DOCX file will be stored in the output item.

Output shape

a list of n8n items matching the input count, each containing the created document in the selected output format.

  • When output format is 'binary', the document is stored as a .docx file in the specified binary property.
  • When output format is 'ooxml', the node outputs an object with the main document XML and related OOXML parts.
  • Base64 and buffer formats output the document content as encoded string or array of bytes, respectively.
  • Errors are emitted per item, and processing can continue on failure if enabled.

Examples

Example 1: Convert input JSON data representing paragraphs and sections into a formatted DOCX file.

Set Content Source to 'From Input Data', set document title and creator optionally, select output format 'Binary (DOCX)', and specify binary property name to store the file.

Example 2: Generate a DOCX document from a custom JSON describing sections with multiple paragraphs and formatting.

Set Content Source to 'Custom JSON', enter the document content JSON, provide document title and creator, choose the output format 'Base64', then use the Base64 document string in subsequent workflow nodes.

Discussion