n8n-nodes-docx-ooxml
v0.1.2
Published
n8n community node for creating DOCX/OOXML documents using docx.js
Downloads
23
Maintainers
Readme
n8n-nodes-docx-ooxml
This 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
Installation
Follow the installation guide in the n8n community nodes documentation.
Community Node Name: n8n-nodes-docx-ooxml
Operations
Create Document
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
Credentials
No credentials required. This node works entirely locally within your n8n instance.
Compatibility
- Minimum n8n version: 1.0.0
- Tested with: n8n 1.x
- Dependencies: docx.js v9.5.1+
Usage
Basic Usage
- Add the DOCX OOXML node to your workflow
- Select Create Document operation
- Choose your content source (Input Data or Custom JSON)
- Configure output format (Binary DOCX, OOXML, Base64, or Buffer)
- Execute the workflow
Content Structure
The node accepts structured JSON data to define document content:
{
"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"]
}
]
}
]
}
]
}Supported Properties
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
Examples
Example 1: Simple Document from Input Data
Input data:
{
"title": "Report",
"content": "This is a simple report."
}The node will automatically convert this to a document with key-value pairs.
Example 2: Structured Document with Custom 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"]
}
]
}
]
}
]
}Example 3: Output as Binary File
Set Output Format to "Binary (DOCX)" and Binary Property Name to "data". The document will be available as a downloadable file in subsequent nodes.
Example 4: Output as Raw OOXML (XML)
Set Output Format to "OOXML (Raw XML)" to extract the raw XML content from the DOCX package. The output will include:
{
"ooxml": {
"word/document.xml": "<w:document xmlns:w=\"...\">...</w:document>",
"word/styles.xml": "...",
"[Content_Types].xml": "...",
"_rels/.rels": "..."
},
"mainDocument": "<w:document xmlns:w=\"...\">...</w:document>",
"files": ["word/document.xml", "word/styles.xml", ...]
}Key OOXML files extracted:
word/document.xml- Main document content (also available inmainDocumentfield)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:
// 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.
Resources
Version History
0.1.0 (Initial Release)
- Create DOCX documents from structured data
- Support for paragraphs, headings, and tables
- Rich text formatting (bold, italic, underline, colors)
- Multiple output formats (Binary DOCX, Raw OOXML/XML, Base64, Buffer)
- Extract raw OOXML XML content from generated documents
- Based on docx.js v9.5.1 and jszip
