m2doc

Generate table columns using m2doc


I would like to know if it is possible to generate columns of a table using m2doc.

Currently, i am able to generate rows of a table by doing this:

{m:for r|rows} 
[] [] []
{m:endfor}

, where [][][] represents a static table with 3 columns.

On top of this i would like to add dynamically columns on the static table. So, i would assume that something like this could work:

{m:for r|rows} 
[] [] [] {m:for s|cells} *tableCell*{m:endfor}
{m:endfor}

However, i am not able to generate the cells horizontally, since that the expression {m:for s|cells} *tableCell*{m:endfor} cannot be formatted in the same line in the word document. So, in the word document it appears as:

{m:for s|cells}                                    *tableCell*
   {m:endfor}

, which results to columns generated vertically.

Has anyone encountered the same problem? Is there a work around it?


Solution

  • You can create a service that returns a MTable and create the table programmatically. For the moment only text can be inserted in the cells of the MTable. You can have a look at the sample table test and the service implementation is in the MTableTestServices.