在我的一个应用程序中,如果用户订购了多个产品,我们必须为每个产品动态创建相同的表结构,并且表结构、样式仅提供给用户,我们只知道归档/标签是固定的。所以任何人都可以指导我们如何在 python 中实现
我尝试使用 docxtpl、python-docx python 库
我已经创建了单个表,但我面临创建多个表的问题,将表推送到新页面
只需使用循环并插入中断页除了最后一个表之外的每个表?
{% for product in products %} {# your table and code for the table here #} {# Break page after each table except the last table #} {% if not loop.last %} {{ '\f' }} {% endif %} {% endfor %}