n8n community node for creating DOCX/OOXML documents using docx.js
npm install n8n-nodes-docx-ooxmlThis is an n8n community node that lets you create DOCX/OOXML documents using the powerful docx.js library in your n8n workflows.
Generate professional Word documents from your workflow data with high-level support for paragraphs, headings, tables, text formatting, and more.
n8n is a fair-code licensed workflow automation platform.
Installation | Operations | Usage | Examples | Resources
Follow the installation guide in the n8n community nodes documentation.
Community Node Name: n8n-nodes-docx-ooxml
Create a new DOCX document from structured data with the following features:
- Document metadata: Set title and creator
- Content sources: Use input data or provide custom JSON
- Output formats: Binary DOCX file, Raw OOXML (XML), Base64, or Buffer
- Rich formatting: Headings, alignment, bold, italic, underline, colors
- Tables: Create structured tables with custom widths
- Paragraphs: Multiple text runs with different styles
No credentials required. This node works entirely locally within your n8n instance.
- Minimum n8n version: 1.0.0
- Tested with: n8n 1.x
- Dependencies: docx.js v9.5.1+
1. Add the DOCX OOXML node to your workflow
2. Select Create Document operation
3. Choose your content source (Input Data or Custom JSON)
4. Configure output format (Binary DOCX, OOXML, Base64, or Buffer)
5. Execute the workflow
The node accepts structured JSON data to define document content:
``json`
{
"sections": [
{
"paragraphs": [
{
"text": "Hello World",
"heading": "Heading1",
"alignment": "center"
},
{
"children": [
{
"text": "Bold text",
"bold": true
},
{
"text": " and ",
"italics": true
},
{
"text": "colored text",
"color": "FF0000"
}
]
}
],
"tables": [
{
"rows": [
{
"cells": ["Header 1", "Header 2", "Header 3"]
},
{
"cells": ["Row 1 Col 1", "Row 1 Col 2", "Row 1 Col 3"]
}
]
}
]
}
]
}
#### Paragraph Properties
- text: String or array of text runsheading
- : "Heading1" through "Heading6"alignment
- : "left", "center", "right", "justified"pageBreak
- : Boolean for page break before paragraph
#### Text Run Properties
- text: The text contentbold
- : Booleanitalics
- : Booleanunderline
- : Booleancolor
- : Hex color code (e.g., "FF0000")size
- : Font sizefont
- : Font family name
#### Table Properties
- rows: Array of row objectscells
- : Array of cell content (strings or objects)width
- : Cell width percentage
Input data:
`json`
{
"title": "Report",
"content": "This is a simple report."
}
The node will automatically convert this to a document with key-value pairs.
`json`
{
"sections": [
{
"paragraphs": [
{
"text": "Sales Report Q4 2024",
"heading": "Heading1",
"alignment": "center"
},
{
"text": "Executive Summary",
"heading": "Heading2"
},
{
"children": [
{
"text": "Total Revenue: ",
"bold": true
},
{
"text": "$1,234,567",
"color": "00FF00"
}
]
}
],
"tables": [
{
"rows": [
{
"cells": ["Product", "Units Sold", "Revenue"]
},
{
"cells": ["Product A", "1,000", "$50,000"]
},
{
"cells": ["Product B", "2,500", "$125,000"]
}
]
}
]
}
]
}
Set Output Format to "Binary (DOCX)" and Binary Property Name to "data". The document will be available as a downloadable file in subsequent nodes.
Set Output Format to "OOXML (Raw XML)" to extract the raw XML content from the DOCX package. The output will include:
`json`
{
"ooxml": {
"word/document.xml": "
"word/styles.xml": "...",
"[Content_Types].xml": "...",
"_rels/.rels": "..."
},
"mainDocument": "
"files": ["word/document.xml", "word/styles.xml", ...]
}
Key OOXML files extracted:
- word/document.xml - Main document content (also available in mainDocument field)word/styles.xml
- - Document stylesword/numbering.xml
- - Numbering definitionsword/settings.xml
- - Document settingsword/_rels/document.xml.rels
- - Relationships[Content_Types].xml
- - Content types_rels/.rels
- - Package relationships
This is useful for:
- Office.js Integration: Use with insertOoxml() to insert content into Word documents
- Inspecting the raw OOXML structure
- Processing XML content with other tools
- Understanding document structure
- Debugging document generation
Office.js Example:
`javascript`
// Insert OOXML into Word using Office.js
await Word.run(async (context) => {
const range = context.document.getSelection();
range.insertOoxml(data.mainDocument, Word.InsertLocation.replace);
await context.sync();
});
See examples/officejs-integration.md` for complete integration guide.
* n8n community nodes documentation
* docx.js documentation
* OOXML specification