Forum


Replies: 3   Views: 3322
Templates in tables
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 barek  · 21-03-2011 - 16:12

I'm trying to add several rows to a table using the provided examples like this:

[code] $docx->addTemplateVariable(
array (
array (
'VAR1' => 'row1 col1',
'VAR2' => 'row1 col2',
'VAR3' => 'row1 col3'
),
array (
'VAR1' => 'row2 col1',
'VAR2' => 'row2 col2',
'VAR3' => 'row2 col3'
)
),
'table'
);[/code]

However, since the table has a header, what happens is that the header is repeated over and over again.
Also, if I have less than three elements added, the template variables show up like this:

[code]
[b]
Header1 Header2 Header 3
Header1 Header2 Header 3
[/b]
row1 col1 row1 col2 row1 col3
row2 col1 row2 col2 row2 col3
$VAR1$ $VAR2$ $VAR3$
[/code]

Everything else (ordinary template variables etc) seem to be working perfectly.
Does anyone have a working example of this, and could tell me which PHP version etc. they are using? I'm using "PHP 5.2.4-2ubuntu5.14 with Suhosin-Patch 0.9.6.2"

Best regards,
Kristian Barek