We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set header and footer in the PDF/Excel/Word exported page?

Platform: ASP.NET Web Forms (Classic) |
Control: OlapClient |
Published Date: July 16, 2015 |
Last Revised Date: July 2, 2019

This KB illustrates that how to set header and footer in the PDF/Excel/Word exported page.


You can set the header and footer in PDF, Excel, and Word exported documents by using the following events:

  • ExportPDF for PDF.
  • ExportExcel for Excel.
  • ExportWord for Word.


In the ExportPDF event, properties are written under the PDFExportSettings class. To display header and footer in the exported document, the properties ShowPDFHeader and ShowPDFFooter should be set to true. The header and footer text can be set by using the PDFHeaderText and PDFFooterText properties, respectively. In addition to this, PDFHeaderDescription property helps you to set the description of the header.


In the ExportExcel event, properties are written under the PageSetup class. The properties, CenterHeader and CenterFooter allow you to set the header and footer in the middle of a page. Likewise, the properties, LeftHeader, LeftFooter, RightHeader, and RightFooter allow the user to set the header and footer in the left or right side of a page.



Header and footer are not displayed in an Excel sheet, by default.  You can enable the header and footer under the Insert tab to show them page wise and also while printing.


In the ExportWord event, properties are written under the WordExportSettings class. To display header and footer in the exported document, the properties ShowHeader and ShowFooter should be set to true. The header and footer text can be set by using the HeaderText and FooterText properties, respectively.


The following code example illustrates how to add header and footer in the PDF, Excel, and Word exported document.


protected void Page_Load(object sender, EventArgs e)
      this.OlapClient1.OlapGrid.ExportPDF += OlapGrid_ExportPDF;
      this.OlapClient1.OlapGrid.ExportExcel += OlapGrid_ExportExcel;
      this.OlapClient1.OlapGrid.ExportWord += OlapGrid_ExportWord;
public void OlapGrid_ExportPDF(object sender, ExportPDFEventArgs e)
      e.PDFExportSettings.PDFHeaderText = "Header";
      e.PDFExportSettings.PDFFooterText = "Footer";
      e.PDFExportSettings.PDFHeaderDescription = "";
      e.PDFExportSettings.ShowPDFFooter = true;
      e.PDFExportSettings.ShowPDFHeader = true;
private void OlapGrid_ExportExcel(object sender, ExportExcelEventArgs e)
      e.PageSetup.CenterHeader = "Center Header";
      e.PageSetup.CenterFooter = "Center Footer";
      e.PageSetup.LeftFooter = "Left Footer";
      e.PageSetup.LeftHeader = "Left Header";
      e.PageSetup.RightFooter = "Right Footer";
      e.PageSetup.RightHeader = "Right Header";
public void OlapGrid_ExportWord(object sender, ExportWordEventArgs e)
      e.WordExportSettings.FooterText = "Footer";
      e.WordExportSettings.HeaderText = "Header";
      e.WordExportSettings.ShowHeader = true;
      e.WordExportSettings.ShowFooter = true;



Protected Sub Page_Load(sender As Object, e As EventArgs)
    AddHandler Me.OlapClient1.OlapGrid.ExportPDF, AddressOf OlapGrid_ExportPDF
    AddHandler Me.OlapClient1.OlapGrid.ExportExcel, AddressOf OlapGrid_ExportExcel
    AddHandler Me.OlapClient1.OlapGrid.ExportWord, AddressOf OlapGrid_ExportWord
End Sub
Public Sub OlapGrid_ExportPDF(sender As Object, e As ExportPDFEventArgs)
    e.PDFExportSettings.PDFHeaderText = "Header"
    e.PDFExportSettings.PDFFooterText = "Footer"
    e.PDFExportSettings.PDFHeaderDescription = ""
    e.PDFExportSettings.ShowPDFFooter = True
    e.PDFExportSettings.ShowPDFHeader = True
End Sub
Private Sub OlapGrid_ExportExcel(sender As Object, e As ExportExcelEventArgs)
    e.PageSetup.CenterHeader = "Center Header"
    e.PageSetup.CenterFooter = "Center Footer"
    e.PageSetup.LeftFooter = "Left Footer"
    e.PageSetup.LeftHeader = "Left Header"
    e.PageSetup.RightFooter = "Right Footer"
    e.PageSetup.RightHeader = "Right Header"
End Sub
Public Sub OlapGrid_ExportWord(sender As Object, e As ExportWordEventArgs)
    e.WordExportSettings.FooterText = "Footer"
    e.WordExportSettings.HeaderText = "Header"
    e.WordExportSettings.ShowHeader = True
    e.WordExportSettings.ShowFooter = True
End Sub


You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile