TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Adding recursive text (DOCX)

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Daniel
Date: 2016-04-01
Time: 18:59

Adding recursive text (DOCX)

Hi there.
I am trying to generate multiple titles/content in a word document like:

Title1
Content1

Title2
Content2

I am using array to store this kind of informations as i post:
$qr_content = array();
    $qr_content[] = array('title'=>'TESTE DE TíTULO MERGING','content'=>'TESTE DE CONTEÚDO MERGING');
    $qr_content[] = array('title'=>'TESTE DE TíTULO MERGING 2 ','content'=>'TESTE DE CONTEÚDO MERGING 2 ');
    $qr_content[] = array('title'=>'TESTE DE TíTULO MERGING 3 ','content'=>'TESTE DE CONTEÚDO MERGING 3 ');
    $qr_content[] = array('title'=>'TESTE DE TíTULO MERGING 4 ','content'=>'TESTE DE CONTEÚDO MERGING 4 ');

on my word document i have i already tested:
[blockcontent.title]
[blockcontent.content]
With this previous code i only get the following:
Title1
Content1

[blockcontent.title;block=tbs:p]
[blockcontent.content]
with this previous code i get the following:
Title1
Title2
Title3
Title4

[blockcontent.title;block=tbs:p]
[blockcontent.content]

with previous code i get the following:
Title1
Content2
Title3
Content4

My php code is not the problem i think:
$TBS->LoadTemplate(__DIR__ .'/../templates/qr_template.docx', OPENTBS_ALREADY_UTF8);
        $TBS->MergeBlock('blockcontent', $qr_content);


No success on both tries...
Can you please help me? I can also post some prints if needed
By: Daniel
Date: 2016-04-02
Time: 18:06

Re: Adding recursive text (DOCX)

SOLVED.

with
[blockcontent.title;block=tbs:p+tbs:p]
[blockcontent.content]