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

Free Support Forum - aspose.com

Header & Footer by page number in worksheet

Hi Team,

Can we set Header & Footer differently by page? I want to determine the footer text by the data i have in that page.

Any help would be much appreciated?


Thanks for your query.

Well, in MS Excel, you may specify header/footer differently for the first page only, see the sample code segment for your reference:
Sample code:

 PageSetup ps = workbook.Worksheets[0].PageSetup;
            ps.IsHFDiffFirst = true;
            ps.SetFirstPageHeader(2, "On &N pages");
            ps.SetHeader(1, "Page &P");

How could you specify your requirement in MS Excel manually? We appreciate if you could create a simple sample Excel file with your desired headers/footers set (via PageSetup’s Header|Footer(tab) options) in MS Excel manually, save the file and provide us here, we will check it on how to do via Aspose.Cells APIs.

Thank you.