Docx Generator — Unique AI Documentation

Docx Generator

The service is integrated into the following modules:

Functionality

The Docx Generator Service enables developers to generate .docx files from predefined templates. It is used as part of a tool or module.
This service is built on top of the docxtpl library, which provides template-based document generation capabilities.

Configuration

Default Configuration

{
  "uploadSuffix": "_report_output.docx",
  "uploadScopeId": null,
  "uploadToChat": true,
  "templateName": "template.docx",
  "templateScopeId": null,
  "templateFields": {
    "date": "CURRENT_DATE",
    "document_title": "Template Document"
  },
  "skipIngestion": true
}
Field Name Description Type Default Value Required
uploadSuffix The suffix of the generated docx file. string _report_output.docx No
uploadScopeId The scope id into which the generated docx file is uploaded. string null No
uploadToChat Whether to upload the generated file to the chat. boolean true No
templateName The name of the template file. string template.docx No
templateScopeId The scope id of the template. string null No
templateFields The fields to be replaced in the template. string {"date": CURRENT_DATE, "document_title": "Template Document"} No
skipIngestion Whether to skip the ingestion (chunking & embedding) of the generated file when uploaded to the knowledge base. boolean true No

Nested Types

TemplateFields

When customizing templateFields, ensure that each placeholder defined in your template has a corresponding field in the configuration.

To automatically insert the current date into your document, set the date field value to CURRENT_DATE.

Field Name Description Default Value Type Required
date The date to be inserted in the template. If not explicitly defined, the current date will be selected. CURRENT_DATE string No
document_title The title of the document. Template Document string No

Default Unique Template

Below you can find the default template that is used by the docxGenerator if no template is configured.

DOCXDoc Template.docxWord documentDownload

The List Bullet style must be added to Quick Style List in the template to have the docxGenerator work properly.

The colored boxes indicate how each section of the document is handled:

"templateFields": {
    "document_title": "Template Document"
}

The service will replace the placeholder {{document_title}} in the template with "Template Document" during generation.

Styling the template

Content added to the template, whether through code or by replacing placeholders, will inherit the styles defined in the template. Make sure to customize these styles in the template file to match your formatting and branding requirements.

Notes