Forum


Replies: 11   Views: 3695
Merge documents
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 admin  · 11-04-2013 - 12:13

Hi,

After checking this snippet, we've found a bug in phpdocx that bad-forms the documents once you add a template.

These are the patches that you must put in the library and that we'll include in the next phpdocx release:

[code]--- CreateTemplate.inc
+++ CreateTemplate.inc
@@ -236,6 +236,18 @@
{
return self::$_templateSymbol;
}
+
+ /**
+ * Setter. Change if DOCX is a template
+ *
+ * @access public
+ * @return void
+ * @static
+ */
+ public static function setBlnTemplate($enable)
+ {
+ self::$_template = $enable;
+ }
[/code]

[code]--- CreateDocx.inc
+++ CreateDocx.inc
@@ -2380,6 +2380,7 @@
} else {
throw new Exception('Unable to create DOCX file.');
}
+ CreateTemplate::setBlnTemplate(false);
}
catch (Exception $e) {
self::$log->fatal($e->getMessage());
[/code]

By the way, there is an "error" on MVa's code:

[code]@@ -15,13 +15,13 @@
$docx = new CreateDocx();
$docx->setEncodeUTF8();
$docx->addText('2 DOCX content');
-$docx->createDocx('doctmp');
+$docx->createDocx('doctmp_other_name');

$docx = new CreateDocx();
$docx->setEncodeUTF8();
$docx->addText('DOCX content');
$docx->addDOCX('tmpdoc.docx');
-$docx->addDOCX('doctmp.docx');
+$docx->addDOCX('doctmp_other_name.docx');
$docx->addText('reDOCX content');
$docx->createDocx($NomDocument);
?> [/code]

Regards.