Hi i am using docxtpl to generate the MS Word documents from python using JINJA template engine, I checked this documentation which says we can use special tags for table rows, columns and paragraphs but i am not able to generate table rows dynamically.
First i tried the following way
{% for name in rows %}
{{ name }}
{% endfor %}
But it adds all items in the same row no new generated.
then i tried the following way as mentioned in the above mentioned documentation.
{%tr for name in rows %}
{{ name }}
{%tr endfor %}
but it generates the following error
Encountered unknown tag 'endfor'.
then i tried the following way, it works but it some how change the generated document margins, formats and styles . all document just mess up visually .
row = self.document.tables[3].add_row().cells # add row
row[0].text = '' #add empty text to create paragraph
row[0].paragraphs[0].add_run('Some value') #use run to add value
row[0].paragraphs[0].style = self.document.tables[3].row_cells(3)[1].paragraphs[0].style
#this line copy the style of previous row cell to the current row cell else styles are not preserved