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.