Categories > OpenTBS with DOCX >

Generate automatically a table

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: christophe
Date: 2013-07-24
Time: 16:39

Generate automatically a table

Hello,

I've a question regarding an automatic generation of a table:

Actually my template look like:
1.1 [mytitle;block=title]
[mybigcontent;tbs.p;onformat=nice_formatting]

The content of mybigcontent is like

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
| Column A        | Column B         |
| My value A      | MyValue CB      |
| My value A      | MyValue CB      |
| My value A      | MyValue CB      |
| My value A      | MyValue CB      |

I would like to generate a table from the elements between | but i'm running into problem, my first try was to use the nice_formatting function to add the table
<w:tbl><w:tr><w:tc><w:tcPr><w:tcW w:w="2392" w:type="dxa"/></w:tcPr><w:p><w:pPr><w:rPr><w:sz w:val="20"/></w:rPr></w:pPr><w:r><w:rPr><w:sz w:val="20"/></w:rPr><w:t>MY</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w="2392" w:type="dxa"/></w:tcPr><w:p><w:pPr><w:rPr><w:sz w:val="20"/></w:rPr></w:pPr><w:r><w:rPr><w:sz w:val="20"/></w:rPr><w:t>MY2</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w="2393" w:type="dxa"/></w:tcPr><w:p><w:pPr><w:rPr><w:sz w:val="20"/></w:rPr></w:pPr><w:r><w:rPr><w:sz w:val="20"/></w:rPr><w:t>MY3</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w="2393" w:type="dxa"/></w:tcPr><w:p><w:pPr><w:rPr><w:sz w:val="20"/></w:rPr></w:pPr><w:r><w:rPr><w:sz w:val="20"/></w:rPr><w:t>MY4</w:t></w:r><w:bookmarkStart w:id="6" w:name="_GoBack"/><w:bookmarkEnd w:id="6"/></w:p></w:tc></w:tr></w:tbl>

but error when opening in word... i think related to the <w:p> includind the table

Did you have any idea how i can achieve that?

Christophe      
By: Sarah Kemp
Date: 2013-07-24
Time: 16:48

Re: Generate automatically a table

I would suggest creating the table in your template, then dynamically removing it in place you do not want it, rather than creating it from scratch.
By: christophe
Date: 2013-07-25
Time: 09:23

Re: Generate automatically a table

Thanks but problem is that i don't know hom many table i will have
it can be also
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
| Column A        | Column B         |
| My value A      | MyValue CB      |
| My value A      | MyValue CB      |
| My value A      | MyValue CB      |
| My value A      | MyValue CB      |
sed do eiusmod tempor incididunt
| Column A        | Column D        | Column C        | Column D        |
| My value A      | MyValue CB      | My value A      | MyValue CB      |
| My value A      | MyValue CB      | My value A      | MyValue CB      |
| My value A      | MyValue CB      | My value A      | MyValue CB      |
| My value A      | MyValue CB      | My value A      | MyValue CB      |