The way Word works does not lend itself to extracting a header to place on the page content. Word is made up of containers for content and in a well designed Word document, the SAME header can appear on hundreds of pages with only minor differences (such as page number incrementing or StyleRef fields updating). I can't understand what your requirement might be to make you think you need to extract and repeat this information repetitively.
The 'page' in Word is not a fixed structure. The formatting and content in the body of the document when constrained by the page size and setup determines what appears on each page. Adding content earlier, pushes subsequent content down the page and potentially onto the next page. The headers/footers are associated with a section which might contain a paragraph, lots of paragraphs or the entire document - but they don't directly relate to 'pages' at all.
Perhaps you need to post a sample document and describe why you think this is necessary. If we could understand what it is you need to achieve, I would think we could suggest a better way of achieving it.
I'm still thinking that Word is not the best tool for this. Its concept of flowing content doesn't fit with the static pages that headers align with. I just watched a video on using LibreOffice Draw to open and edit a PDF. I think this might be a better fit for your requirements as it appears to be scriptable with Python and should retain the page content more accurately.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Last edited by Guessed; 06-09-2021 at 04:42 AM.
|