Search code examples
opentbsods

Header cell with same length as underlying cells in OpenTBS


I want to have length of header cell (composed of merged cells) equal to amount of underlying generated cells

[                               header value                         ]
[cell value 1][cell value 2][cell value 3][cell value 4][cell value 5]

I use plugin OpenTBS for TinyButStrong Template Engine. So I added to ods template:

[headerCell]
[select11.[select10.c1;block=tbs:cell];block=tbs:row]

which produces content

[header value][            ][            ][            ][            ]
[cell value 1][cell value 2][cell value 3][cell value 4][cell value 5]

How to specify this behaviour to header cell.


Solution

  • For LibreOffice, the horizontal cell merging is define with the XML attribute table:number-columns-spanned. See XML Synopsis

    This attribute can be modified with TBS using the parameter att.

    Example :

    Template:

    |headerCell[my_field]|
    

    PHP:

    $nb_cell = ...; // retrieve the number of cell to merge horizontaly
    $TBS->MergeField('my_field', $nb_cell, false, array(
      'att'=>'table:table-cell#table:number-columns-spanned'
     ));