How to remove header / footer from a specific page number

Hi,


We are creating a word document using Aspose.Word. Our requirement is we don’t want header and footer in some of the pages.

we have looked into most of the options available with Aspose.word but most of them speaks out removing the header footer completely or from odd / even pages or placing them in even and odd pages.

Is there any way that we can remove the header or footer from a particular / specific page number.

Hoping for an early response.

Regards,
Mahesh
Hi Mahesh,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does.

HeaderFooter is a section-level node and can only be a child of Section. A Section can have one Body and maximum one HeaderFooter of each HeaderFooterType. Body and HeaderFooter nodes can be in any order inside Section.

Please read about Aspose.Words document object model from following link.
Aspose.Words Document Object Model

In Word document, a section can have one or multiple pages. If a document have multiple pages, the same header/footer will appear on all pages of section.

In your case, we suggest you please insert the section break (continuous) at the end of every page of document and insert the separate header/footer for each section. Once you have header/footer for each page, you can remove them by using Section.HeadersFooters.Clear method. Hope this helps you.