Categories > OpenTBS with DOCX >

Unable to MergeField .docx

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Thomas
Date: 2011-09-07
Time: 15:06

Unable to MergeField .docx

I must be doing something really stupid here but I cannot get the simplest MergeField on a word document to work. I have no trouble with the automatic merges from global variables such as OnShow. Debug shows no errors only my tag [data.facility] in unchanged.
include('classes/tbs_class.php');
include('classes/tbs_plugin_opentbs.php');
$tbs = new clsTinyButStrong;
$tbs->PlugIn(TBS_INSTALL,OPENTBS_PLUGIN);
$tbs->LoadTemplate($boilerplate);
$tbs->PlugIn(OPENTBS_DEBUG_XML_SHOW); 
$tbs->MergeField('data',array('facility' => 'Test Facility'));
$tbs->Show(OPENTBS_FILE,$stamped_boiler_path); 

Above is my php and I have a single .docx with a single tag [data.facility]

Any help would be greatly appreciated.

Thanks, Thomas     
By: Skrol29
Date: 2011-09-07
Time: 21:45

Re: Unable to MergeField .docx

Hi,

The manual says:
OPENTBS_DEBUG_XML_SHOW: Ends the merge process as if the final document was created.

Thus your MergeField() call is never rendered.
If the fields is never merged even in normal mode, then search the place of the [data.facility] field in the template (using the debug mode) and check if it is not split by some XML elements.