Performance Guidelines
Version: 1.0
Valid From: 01.06.2025
dox42 allows for very fast document generation in general. Normally you don’t need to worry about performance. However, there are scenarios that can impact docgen performance and require additional optimization.
Examples:
In these scenarios, plan additional optimization effort. This document provides best practices and tips.
Example: A collective invoice with 500 positions. For each position you load:
This results in 1000+ SharePoint downloads and 500 Dynamics calls in one generation process. Such high request volume may trigger Microsoft throttling and stall performance.
Extend the data provider (e.g., Dynamics report) to include dependent data. This eliminates hundreds of look-up calls. For Dynamics CE, use FetchXML.
Load all dependent data in one call (e.g., all product descriptions). Use the look-up function in the data map (available since version 5) to establish dependencies.
The look-up is then performed in memory, avoiding additional loads.
In very large templates with many datasets or tables, replacing non-looping conditional automate ranges with dynamic fields can improve performance.
Automate ranges usually do not noticeably impact performance. However, when processed across many iterations, performance can improve by replacing simple conditional show/hide ranges with dynamic fields.
Example scenario:
A large table contains contact information. Additional notes should appear if a contact preordered a ticket.
Instead of a conditional automate range, use a dynamic field with logic like:
If condition Then
result = "Additional note"
Else
result = ""
End If
This produces the same output with better performance when processing large datasets.
Create a TRACE log (available since Version 5 in the Add-In).
Steps:
This allows analyzing:
For large repetitive documents (e.g., yearly reports, printer output), use the bulk letter functionality.
With dynamic naming, a separate file is created per dataset loop.
Files can be processed via printer drop folder.
If merging is required:
Using a loop with datafield type PDFAttachment results in a merged document.
For DOCX merging, use datafield type WordDoc. PDFAttachment is inserted only when output format is PDF.
Since version 5, the DocGen datasource allows creating sub-templates integrated into the main document.
If large content (e.g., complex tables) must be shown or hidden based on conditions, move it into sub-templates.
Hidden sub-templates are not calculated in the background, improving performance.
Inserting high-quality images or PDFs increases file size and slows download speed. This mainly affects graphically advanced documents.
Optimization for PDFs:
Since images are larger than appended PDFs, using PDFAttachment can significantly reduce file size.