elapouya / python-docx-template

Use a docx as a jinja2 template
GNU Lesser General Public License v2.1
1.98k stars 385 forks source link

Adding multiple statements to table #513

Open Martmists-GH opened 11 months ago

Martmists-GH commented 11 months ago

Describe your problem

index x y z
{% for entry in entries %} {% if entry.index != "total" %}
{{ entry.index }} {{ entry.x }} {{ entry.y }} {{ entry.z }}
{% endif %} {% endfor %} {% set entry = entries[-1] %}
Total {{ entry.x }} {{ entry.y }} {{ entry.z }}

More details about your problem

Where do I put the tr in this case? No matter what I try, it always says I'm closing an if when I should be closing a for, or the other way around.

Provide a test case

See above

Screenshots

N/A

SergeyZaykov commented 10 months ago

Choose one solution total.docx total gen