Open jodyphelan opened 3 weeks ago
I would like to create a table like the example image below. I tried to use a nested for loop like
However this seems to ignore the initial loop and gives this:
Is there a way of using nested loops?
Here is the code used to render the template:
from docxtpl import DocxTemplate tpl = DocxTemplate('template.docx') context = { 'data': [ {'type': 'Fruit', 'names': ['Apple', 'Banana']}, {'type': 'Vegetable', 'names': ['Carrot', 'Onion']}, ] } tpl.render(context) tpl.save('output/result.docx')
Describe your problem
I would like to create a table like the example image below. I tried to use a nested for loop like
However this seems to ignore the initial loop and gives this:
Is there a way of using nested loops?
More details about your problem
Here is the code used to render the template: