python-docx-template icon indicating copy to clipboard operation
python-docx-template copied to clipboard

Forms and documents are corrupted when using vm tags

Open phybrain opened this issue 1 year ago • 4 comments

Describe the bug

A clear and concise description of what the bug is. my template:
image my result:
image There are only 2 rows, and the rest of the forms and documents have all disappeared

To Reproduce

python 3.6.6, docxtpl==0.16.7,python-docx==0.8.11

phybrain avatar Jan 05 '24 08:01 phybrain

Please, provide a fully runnable test case, not just pictures.

Message ID: @.***>

elapouya avatar Jan 05 '24 08:01 elapouya

Please, provide a fully runnable test case, not just pictures. Message ID: @.***>

from docxtpl import DocxTemplate, InlineImage

tpl = DocxTemplate('./test.docx')

context = {
    'repeat_purchase_list': [{'total': 100, 'name': 'A', 'count': 1}, {'total': 200, 'name': 'B', 'count': 1},
                             {'total': 300, 'name': 'C', 'count': 1}, {'total': 400, 'name': 'D', 'count': 1}
                             ]

}

tpl.render(context)
tpl.save('./out.docx')

test.docx

I upload my test docx template,thankyou.

phybrain avatar Jan 05 '24 09:01 phybrain

I confirm the bug and I got workaround.

I selected the table and changed the style to Normal (test Normal style.docx). The output document was as excpected.

I found out that changing the font didn't resolve the bug.

SergeyZaykov avatar Jan 11 '24 23:01 SergeyZaykov

I confirm the bug and I got workaround.

I selected the table and changed the style to Normal (test Normal style.docx). The output document was as excpected.

I found out that changing the font didn't resolve the bug.

Thanks.

phybrain avatar Jan 12 '24 02:01 phybrain