Reputation: 11
How can I format a footer (bold, italic, font-size) using python-docx. The code below throws an exception (invalid syntax)
section = document.sections[0]
footer = section.footer
my_footer = footer.paragraphs[0]
my_footer.text = (f"This ist my {addvariable} footer", style = 'Calibri_10')
Upvotes: 1
Views: 1031
Reputation: 28883
Here's how you can make it bold, for example:
section = document.sections[0]
footer = section.footer
my_footer = footer.paragraphs[0]
my_footer.text = f"This ist my {addvariable} footer"
my_footer.runs[0] = bold
I'd suggest spending some time with the Quickstart section of the documentation to get a feel for the basic concepts and operations for working with python-docx
.
Upvotes: 1