Recently, version 0.8.8
of python-docx
added direct support for headers and footers.
Now one can simply add a header or footer as follows:
from docx import Document
document = Document()
header = document.sections[0].header
header.add_paragraph('This is an example Header')
footer = document.sections[0].footer
footer.add_paragraph('This is an example Footer')
Prior to this release, one could add headers and footers flexibly using a template approach.
With templates it is very straightforward to include things such as page numbers. However, this does not seem to be the case with the implementation of headers and footers in the new versions.
Is there an easy way to add page numbers in versions 0.8.8
and later?