Categories > OpenTBS with DOCX >

Docx column merge

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: felipe
Date: 2015-08-13
Time: 14:32

Docx column merge

Hi i have a dynamic table (rows and columns) and the first row have the titles of each column but i need them to have colspan = 6. i looked the xml on docx and the att is called gridSpan but don't know how to use it correctly. The table must look like this.
______________________________________________________________________________
|_________|__________N1_________|__________N2__________|__________N3__________|
|              |    |    |    |    |     |    |    |     |    |    |      |    |     |     |     |    |    |    |


My template looks something like this, the nombres.val are the ones that i need them to be colspan =6 because i know that cats.val are grouped by 6 and same as the matriz_sub1.val.

[prueba]                                                                          |    [nombres.val;block=tbs:cell]
                                                                                     |    [cats.val;block=tbs:cell]
[matriz.titulo;block=tbs:row;sub1=porc;when [matriz.depth]=1]   |    [matriz_sub1.val;block=tbs:cell]
[matriz.titulo;block=tbs:row;sub1=porc;when [matriz.depth]=2]   |    [matriz_sub1.val;block=tbs:cell]
[matriz.titulo;block=tbs:row;sub1=porc;when [matriz.depth]=3]    [matriz_sub1.val;block=tbs:cell]

nombres is an array of X elements (cats and matriz have 6*X elements)

Example of nombres:

Array
(
    [0] => Promedio
    [1] => A
    [2] => PI
)


Right now the template is working but on the first row i only get colspan=1.

2014_Singapur_U3_GeometrĂ­a_3Basico    Total    3BA
                                                    T    A    MA    MB    B    I    T    A    MA    MB    B    I
NĂºmeros y operaciones                          40    28    0    7    5    1    40    28    0    7    5    1


If i can get some help would be great
By: felipe
Date: 2015-08-19
Time: 15:48

Re: Docx column merge

I still can't figure out how to do this. If someone can help me it would be great (or if this can't be done also would be great to know)

Thx
By: Skrol29
Date: 2015-08-26
Time: 17:44

Re: Docx column merge

Hi Felipe,

Merging cell horizontally cannot be done directly with an OpenTBS feature.

Merging cells horizontally in a DOCX table consists in adding an <w:gridSpan w:val="2"/> element in the <w:tcPr> element of the cell, and deleting hidden cells.
You can do it by modifying the XML contents directly in PHP.