Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Nov 21, 2022 2:44 am

The HeaderFooter class does not have a property which provides the type of header or footer it is.

The API defines an enumeration: HeaderFooterType but this is not a property of each instance of a HeaderFooter object, according to the API: HeaderFooter

It would be useful to be able to determine the type when iterating through the HeadersFooters as a collection.

Les43625
 
Posts: 12
Joined: Tue Feb 22, 2022 1:41 am

Mon Nov 21, 2022 9:12 am

Hello,

Thanks for your inquiry.
Sorry, it’s impossible to tell currently which is the header and which is the footer. However, you can directly get the header and footer of the section. I put the relevant code below for your reference.
If you have any issue, just feel free to contact us.
Code: Select all
   //Get the collection of footer and header of section 0
            HeadersFooters headersFooters = doc.Sections[0].HeadersFooters;

            //Get the header of the section 0
            HeaderFooter header = headersFooters.Header;

            //Get the footer of the section 0
            HeaderFooter footer = headersFooters.Footer;


Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.Doc