replaceVariableByHTML 関数を使用して単語内の複数の変数を置き換えようとしています。また、 replaceVariableByText を使用してテキストを置き換えています。replaceVariableByText のみを使用している場合はすべて問題ありませんが、html 置換を追加すると問題が発生します - ドキュメントが生成されません。変数を HTML コードのみに置き換えようとしましたが、1 つの変数しか置き換えられません。私は何か間違ったことをしていますか?これは私のコードです:
//$htmlData and $data are array('name' => 'value')
$docx = new \CreateDocxFromTemplate($templateDir);
$docx->setTemplateSymbol('‡');
$docx->replaceVariableByText($data, array());
foreach($htmlData as $key => $value)
$docx->replaceVariableByHTML($key, 'block', $value);
$filename = uniqid();
$uniqName = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename.'';
$docx->createDocx($uniqName);
header('Content-Type: application/vnd.openxmlformats-officedocument.' .
'wordprocessingml.document');
header('Content-Disposition: attachment; filename="' . $templateSymbol .
'.' . $this->documentExtension . '"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($uniqName . '.' . $this->documentExtension));
readfile($uniqName . '.' . $this->documentExtension);