Let's say I have a certain paragraph in my docx document with certain text formatting, for example:
"Foo bar"
I want to make something like a template of this paragraph to copy it into the same document multiple times.
Copying text like in the example means loosing text formatting.
from docx import Document
document = Document('input.docx')
template = document.paragraphs[0]
for x in range(100):
document.add_paragraph(template.text)
document.save('output.docx')
Is there any generic way to do it with python-docx library?
Other solutions for python and django in particulary are appreciated as well!
Thanks in advance.