I have a doc file with a header. I would like to add more pages to this file and copy and paste the header from the first page into all the new pages.
from docx.parts.hdrftr import HeaderPart
document = Document("Template.docx")
document.add_page_break
h = document.sections[0].first_page_header
p = h.part
copyHdr = None
for k in p.package.parts:
if isinstance(k, HeaderPart):
copyHdr = copy.deepcopy(k)
print(k)
newHeader = document.add_heading()
I can get the header, but what part or parts I should copy? Where I'll add it? Thanks
Here is a screenshot showing what I am trying to have. enter image description here