We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ClearHeaderFooter does not clear FirstPage or Even Headers & Footers


I’m assuming this is by design that the PageSetup method ClearHeaderFooter only clears the base header and footer, and not FIrstPageHeader, FirstPageFooter, EvenPageHeader and EvenPageFooter?

It’s easy enough to write the extra code, but a ClearAllHeaderAndFooters would be awesome.



I think you may cope with it by adding the line(s) of code before calling ClearHeaderFooter method:
Sample code:

    worksheet.PageSetup.IsHFDiffFirst = false;
    worksheet.PageSetup.IsHFDiffOddEven = false;

Hope, this helps a bit.


Thanks, I did find that changing those settings to false gave me the output I was looking for.


Good to know that your issue is sorted out by the suggested lines of code. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.