Skip to content

XDoc

Introducion

The XDoc task is a powerful tool for generating documents within your process using template documents from the Dirigent documents section. By leveraging this task, you can dynamically populate document templates with data and generate output files with customized content.

Breakdown of XDoc

Template Selection: You start by selecting a template document from the Dirigent documents section. This template document serves as the basis for generating the output document. It can be in various formats, such as DOCX, ODT, or HTML.

Input Mapping: Within the XDoc task, you define input mappings that associate document variables in the template with process variables or specific strings. These document variables act as placeholders that will be replaced with actual values during the document generation process.

Variable Replacement: When the XDoc task is executed, it retrieves the template document and performs variable replacement based on the input mappings. Process variables are used to provide dynamic data that populates the corresponding document variables in the template. Alternatively, you can specify static strings to replace specific document variables.

Output Generation: The XDoc task generates an output file with the same document type as the input template document. The content of the output file is dynamically generated by replacing the document variables with the provided values. This ensures that the generated document reflects the desired data and structure.

Optional Conversion: Optionally, the generated output document can be converted to PDF and/or XHTML formats. This allows you to obtain the document in different formats based on your specific requirements or downstream processes.

Templating Engine: The XDoc task supports both the Velocity and Freemarker templating engines. You can choose the one that best fits your needs and switch the syntax used in the input document accordingly. These templating engines provide powerful capabilities for conditional logic, loops, and data manipulation within the document template.

What about XML document created with MS Office, OpenOffice or LibreOffice?

XDoc task uses external library the XdocReport to convert input XML document created with MS Office (docx, pptx) or OpenOffice (odt), LibreOffice (odt). A certain degree of incompatibility between aforementioned may occur.

Configuration

  • Name - The display name of the task.
  • Input file - File used as a template. Can be done for .docx, .odt, pptx, or .ods format.
  • Output file name - Name of the document that will be generated.
  • Template engine - FREEMARKER or VELOCITY.
  • Convert to PDF - Converts the output file to PDF format.
  • Convert to XHMTL - Converts the output file to XHMTL format.
  • Var value - Value or value expression.
  • Log on complete - Prints the response in the case log.
  • Response - List of document objects.
Depending on which syntax you prefer, you can choose a templating engine, either Freemarker or Velocity:

Freemarker syntax

${documentVar}
Velocity syntax
$documentVar

Example