I'm having trouble trying to fill in a table row by row using DocxTemplate. I'm only confused on how the template should look like.
This is my python code:
from docxtpl import Docxtemplate
doc = DocxTemplate("Template.docx")
context = {}
table_info = [{start: "A", end: "C"}, {start: "B", end: "C"}, {start:"F", end:"L"}, {start:"B", end:"R"}]
context["table_info"] = table_info
doc.render(context)
doc.save("Finish.docx")
I want the final result to be in a table like this:
| start | end |
| A | C |
| B | C |
| F | L |
| B | R |
Would anyone be willing to show me how I can accomplish this? I saw the dynamic_table_tpl example but I wasn't able to wrap my head around what I'm trying to do. Thanks in advance!
from Span columns with docxTemplate python
No comments:
Post a Comment