I have a word template with 418 variables that I am replacing for numbers.
When calling the replaceVariableByText method it takes 3-4 seconds to complete on a single page document.
I have multiple pages to process which leads to a total processing time of 15 seconds which is too long.
I tried disabling preprocessing like this:
new CreateDocxFromTemplate($file, ['preprocessed' => true]);
This reduced the time to a few milliseconds but only a handfull of variables get replaced.
Manually calling processTemplate fixes that issue but now the same time is spent:
$docx->processTemplate(['document' => array_keys($repV)]);
So the processTemplate be it manually or automatically triggered is very slow and consumes 100% cpu while it runs.
Any ideas how to improve this?
Thanks