【发布时间】:2014-09-30 09:03:21
【问题描述】:
我正在使用 phpdocx 来生成 word 文档。
我已经动态地改变了文字的标题。 所以我想用 dnamically 替换标题变量。 phpdocx论坛他们说可以使用WordFragment方法完成,但它不起作用.. http://www.zxcv.phpdocx.com/en/forum/default/topic/734
这是我将 $TESTTT$ 变量放在标题中的代码
//path to the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocxFromTemplate('Doc.docx');
//create the Word fragment that is going to replace the variable
$wf = new WordFragment($docx, 'document');
$text='try to add head';
$wf->addText($text);
$docx->replaceVariableByWordFragment(array('TESTTT' => $wf), array('type' => 'block'));
$docx->createDocx('tessst');
【问题讨论】:
-
你应该在phpdocx论坛询问
-
我也完成了。我想快速解决这个问题