i'm constructing a docx file from a set of smaller templates and the .docx file looks fine. however when i convert it to a pdf or html those sections brought in by replaceVariableByExternalFile are missing from the converted document. if i open the .docx file in ms word and save as a new .docx file the conversion will work correctly. has anyone else overcome this with wordfragments or merge or another mechanism?
--code snippet--
private function replacePartial($var,$docx) {
$tempDir = sys_get_temp_dir();
$tmpFile = $tempDir."/".uniqid().".docx";
$docx->createDocx($tmpFile);
$this->templateProcessor->replaceVariableByExternalFile([$var=> $tmpFile]);
unlink($tmpFile);
}
template snippet (@summary@, @analysis@ and @attachments@ are all using replacePartial above)
@summary@
@analysis@
@attachments@
body of main template @name@
--results--
the .docx file has everything included cleanly. the .pdf file from the conversion only has the 'body of main template Joe User' portion. if i save the .docx file using MS Word and convert again, all is perfect.