I am still trying to figure out this table thing, which is the main reason we purchased phpdocx pro.
I created the simplest template I could think of using Word 2007. It's just a table with the first row containing text (header) and then one row with variables, just like in your demo.
I even enclosed it in $BLOCK_table$, just like the demo. Also there is a variable $vardump$ after that, and that's it.
I then created an array of arrays (3 data rows) and used
$docx->addTemplateVariable($terminData, 'table', array('header' => false));
to create the table. I also replaced the vardump variable with a var_dump of my data array.
The resulting docx has only one row in the table (plus the fixed header), but the vardump shows that there are actually three items in the array (each of which is itself an array of course).
What could be the problem?
Things I checked:
- special chars like Umlauts --> not the reason, there are none in my testdata
- empty variables --> not the reason, if I prepend "foo" to all values, it still only creates one row
What am I doing wrong? I really need this to work, but I seem to be missing something here. I would gladly send you the template and the resulting docx as well as some more code, if you could give me an idea on how to fix this...
Cheers,
Lorenz