i've got a problem with new lines in templates.
In my template (made in word) I can use 'Enter' for a new paragraph. This works fine when I include a template in phpdoc with the addTemplate() method. I can generate a good docx file.
But Word also allows you to create a new line within a paragraph. To do this, don't press Enter. Instead, press Shift-Enter. Phpdocx create a corrupt document when I use a template with a 'Shift-Enter' in it WITH a registered variabele. It wil generate fine, if I use a non existing variabele or no variabele at all.
for example:
[b]template1.docx[/b]
-----------------------------
Testing
Hi $name$ this is a test
Bye
[b]template2.docx[/b]
-----------------------------
Testing
Hi $name2$ this is a test
Bye
New lines in both templates are done with Shift-Enter. Only difference between templates is variabele name ($name$ vs $name2$)
[b]PHP code:[/b]
$oDocx = new CreateDocx();
$oDocx ->addTemplate('./template1.docx');
$oDocx ->addTemplateVariable('name', 'Roy');
$oDocx ->createDocx('sample')
* This wont't work with template1. It generates a corrupt file. Variable 'name' should be replaced in template.
But the next code will work fine.
$oDocx = new CreateDocx();
$oDocx ->addTemplate('./template2.docx');
$oDocx ->addTemplateVariable('name', 'Roy');
$oDocx ->createDocx('sample')
* template 2 has 'name2' variabele. But only 'name' is registered. So 'name2' is not replaced. This works fine. But in the generated docx file i still got $name2$ of course. But it opens fine without an error.
Of course I want a working situation for template1. Many of our customers uses Shift-Enter in their document with template variabeles. (for example their adress over a few lines)
[b]Word error message is:[/b]
The file sample.docx cannot be opened because there are problems with the contents
--> details: Unspecified error. Location: Part: /word/document.xml, line 2, column: 0
Has anybody a solution?