Render
AI-generatedOverview
This node renders a DOCX template into a document using provided context data. It is useful for generating customized Office documents such as reports, contracts, or letters by filling placeholders in a DOCX template with dynamic data. For example, it can be used to create personalized invoices by merging customer data into a predefined invoice template.
Use Case Examples
- Generating a personalized contract by merging client details into a DOCX template.
- Creating a report document by filling in data from a database into a DOCX template.
Properties
| Name | Meaning |
|---|---|
| Input File Name | The name of the binary input field containing the DOCX template file to be rendered. |
| Data | The JSON object containing the context data to fill into the DOCX template placeholders. |
| Options.Extra Modules | Additional Docxtemplater modules to load for extended functionality. These modules must be installed in the n8n environment. |
| Options.File Name | The name of the output rendered DOCX file. |
| Options.Paragraph Loop | Whether to remove additional spaces caused by loop tags in the template. |
| Options.Put Output File in Field | The name of the binary output field to store the rendered document. |
| Options.Render Newlines | Whether newline characters in tags should be rendered as line breaks in the output. |
Output
Binary
The rendered DOCX document is output as binary data in the specified output binary field.
JSON
binary - The binary data of the rendered DOCX document.
Dependencies
- Requires the 'docxtemplater' and 'pizzip' libraries for DOCX template processing.
- Supports loading additional Docxtemplater modules which must be installed in the n8n environment.
Troubleshooting
- Common errors include template syntax errors or missing placeholders in the DOCX template, which will throw detailed TemplateError messages.
- If the node fails due to module loading issues, ensure the specified extra modules are installed in the n8n environment.
- Errors during rendering may include JSON parsing issues in custom filters or data resolvers; verify the input context data format.
Links
- Docxtemplater Configuration - Paragraph Loop - Documentation on how to use paragraph loop option to remove additional spaces due to loop tags.
- Docxtemplater Configuration - Linebreaks - Documentation on how to enable rendering of newline characters in tags.
- n8n DocxTemplater Node GitHub Repository - Source code and documentation for the DocxTemplater node in n8n.