0

I am using TBS, It works fine when I Merge objects and Associative Arrays php, But I don't know how Merge an array in PHP like this: (It is json for major compression):

data = [{"d_secuencia":"137",
"d_consecutivo":"DOC21 75",
"concepto":"DOCUMENTO DE PRUEBA",
"nombres":["PET1","PET2","PET3","PET4"],
"fecha":"2022-06-11",
"valor":250000
}];

I merged with MS Word [d.concepto] [d.valor] [..] and it works perfects!!. But I have tried different ways: for the merge [d.nombres] and MS Word does not show nothing: Not working:

[d.nombres.key;block=tr]
[d.nombres.val;block=tr]
[d.nombres.val]
[d.nombres[].val]
[d.nombres[0].val]
[d.nombres.#]

What is the syntax for this?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38

1 Answers1

0

You seem to need both automatic subblocks and merging with values (instead of recordset).

Here is an example of what you can do with an HTML template. You can adapt it for Ms Word :

PHP :

$TBS->MergeBlock('d', $data);

HTML :

<p style='border: 1px solid blue; padding: 4px;'>
    [d.concepto;block=p;sub1=nombres]
    <table border='1'>
        <tr>
            <td> [d_sub1.val;block=tr]  </td>
        </tr>
    </table>
</p>

Here is the doc for automatic subblocks.

Skrol29
  • 5,402
  • 1
  • 20
  • 25