We generate documents using PhpOffice\PhpWord\TemplateProcessor's templates. Now client wants to change format to .odt.
How can we do that without rewriting the whole function, or at least using a similar template approach (we create a word with variables and then programatically fill it with values from the database)?
TemplateProcessor seems to only work with .docx documents.
\PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true);
$doc = new TemplateProcessor(resource_path('path/to/document.docx'));
$doc->setValue('random_index1', $data['random_index1']);
$doc->setValue('random_index2', $data['random_index2']);
$filePath = tempnam(sys_get_temp_dir(), 'PHPWord');
$tempFile = $doc->saveAs($filePath);