All of the HeaderFooter objects are NOT null. Only headerPrimary has some text
From the example code I have seen, I am expecting headerFirst and headerEven to be null.
Is my expectation correct? If so, any ideas why headerFirst and headerEven is not null?
Thanks for your inquiry. Please ZIP and upload your input Word document (.docx/.rtf file etc) here for testing. We will investigate the issue on our end and provide you more information.
HeaderPrimary - contains some text → Letter Head Header text
HeaderFirst - does not contain any content
and following three footers in your document.
FooterEven - does not contain any content
FooterPrimary - does not contain any content
FooterFirst - does not contain any content
So, Aspose.Words will not return any of them as NULL.
You can re-save DOC file to DOCX by using MS Word. Rename DOCX to ZIP and extract the ZIP file to a folder. Go to ~/word folder to see files for headers and footers (see screenshot). So, Aspose.Words has no issues in this case.
Thanks for you reply.
I created the document from scratch and was unable to NOT have HeaderFirst, HeaderEven and FooterFirst and FooterEven.
Do you know how to remove this from the document?
There can be a maximum of only one HeaderFooter of each HeaderFooterType per Section. Talking about headers, there are of three types i.e. HeaderFirst, HeaderPrimary and HeaderEven; so up to three different headers are possible in a section (for first, even and odd pages). So, in order to remove a particular HeaderFooter from a Section, you can use the following code: