Forum


Replies: 2   Views: 3897
Merge functions
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by kph  · 18-12-2012 - 16:04

We have some files that we want to merge.
I put the filenames in a php array. But why does it not work.... The '' and the , looks right when i print the array... If i type the filenames in the mergedocx function it works....

////////////////////////////////////////////////////////////
require_once '../../classes/DocxUtilities.inc';

foreach($Array_TGW_Items_GET as $value) {
$Array_Items .= "'../tgw/$value.docx',";
}

$Array_Items = substr($Array_Items,0,-1);
$newDocx = new DocxUtilities();
$options = array('mergeType' => 0);
$newDocx->mergeDocx($Array_Items,'../tgw/mergedDocx.docx', $options);

///////////////////////////////
output $Array_Items = '../tgw/1209.docx','../tgw/1207.docx','../tgw/1098.docx','../tgw/1103.docx'

Error message
[Tue Dec 18 16:57:31 2012] [error] [client 172.16.2.1] PHP Catchable fatal error: Argument 1 passed to DOMDocument::importNode() must be an instance of DOMNode, null given, called in /phpdocx_pro/classes/DocxUtilities.inc on line 708 and defined in /phpdocx_pro/classes/DocxUtilities.inc on line 2363


Posted by admin  · 11-04-2013 - 12:13

Hello,

You can't use an array as first parameter of mergeDocx method. Please check included examples, none of them use an array.

Regards.