我正在使用http://www.tinybutstrong.com/plugins/opentbs/demo/demo.html并且无法使其正常工作。我的 .docx 有真正的 word 邮件合并字段。我一直在试图理解文档,我能从中得到的只是 PHP 演示代码,似乎声明了 $your_name,然后它神奇地替换了 .docx 中的 onshow.your_name。
在第一个实例中,我以为我使用了带有 $data 数组的 MergeBlock。到目前为止,这是我的代码:
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
$template = $_SERVER['DOCUMENT_ROOT'] . '/inc/dd.docx';
$data = array();
$data[] = array('ContactName'=>$this->title . ' ' . $this->firstname . ' ' . $this->surname,
'Address1'=>$this->address1,
'Address2'=>$this->address2,
'Address3'=>$this->town,
'Address4'=>$this->county,
'PostalCode'=>$this->postcode,
'Bacsref'=>$this->bb_number,
'Account_Name'=>$this->ac_name,
'SortCode'=>$this->CorrectedSortCode,
'Account_Number'=>$this->CorrectedAccountNumber);
$ContactName = $this->title . ' ' . $this->firstname . ' ' . $this->surname;
$TBS->LoadTemplate($template);
$TBS->MergeBlock('a,b', $data);
$file_name = $this->bb_number . ' Direct Debit';
//$TBS->Plugin(OPENTBS_DEBUG_XML_CURRENT);
$TBS->Show(OPENTBS_DOWNLOAD, $file_name . '.docx');
下载的文件没有替换任何邮件合并字段。从演示中,我无法推断出看起来不像真正的单词邮件合并字段的 onshow.your_name 是如何被替换的?我所看到的只是一些错误检查代码来确定 $your_name ...