Categories > OpenTBS with DOCX >

Generate Sub-block with OpenTBS.

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Genesis
Date: 2016-10-20
Time: 16:55

Generate Sub-block with OpenTBS.

Hello Skrol29 !

First great work for this lib.

I encounter a problem when i try to generate a docx file with nested array.

In fact, when i try to use sub-block with "sub1" key , nothing is displayed.

I would like to display the sub-array 'spokenlg' in a table.

Here is my code (for the example, i use the array from the documentation, but my data is pretty close to it) :

   $data = array(
           array('name'=>'Peter', 'spokenlg'=>array( 'US', 'FR' ) ),
           array('name'=>'Paul',  'spokenlg'=>array( 'US' ) ),
           array('name'=>'Jack',  'spokenlg'=>array( 'FR', 'ES', 'IT') ),
       );

       $this->TBS->MergeBlock('body', $data);


And here is my template :


hello
[body.name;block=tbs:page;sub1=spokenlg]
a user language : [body_sub1.val;block=tbs:p]


and my result :

hello
Peter
a user language : [body_sub1.val;block=tbs:p]


Is this a problem with OpenTBS or am i missing something ?

Thanks in advance !
By: Skrol29
Date: 2016-10-22
Time: 00:43

Re: Generate Sub-block with OpenTBS.

Hi,

Some revision formats, spelling errors and grammar errors may split the inner XML source of TBS tags in the template.
Such split tags are quite often not recognized by OpenTBS.
You can clean-up a split tag by select it, then cut, and then do a  « paste without formatting ».
You can also clean-up split tags using the OpenTBS add-in for Ms Word given with the OpenTBS package.