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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set Header and Footer while exporting SfDataGrid into PDF?

Platform: UWP |
Control: SfDataGrid |
Published Date: January 14, 2016 |
Last Revised Date: January 14, 2016

The SfDataGrid can be exported into Pdf with Header and Footer using PdfHeaderFooterEventHandler property in PdfExportingOptions.

C#

 

You can insert string, image or any drawing in header and footer in PdfHeaderFooterEventHandler. Setting PdfPageTemplateElement to PdfHeaderFooterEventArgs.PdfDocumentTemplate.Top loads the content at top of the page and setting the PdfPageTemplateElement to PdfHeaderFooterEventArgs.PdfDocumentTemplate.Bottom loads the content at bottom of the page.

Drawing string in Header

String can be inserted in header or footer by using DrawString method. In the same way, you can insert image, ellipse or arc into the header or footer.

C#

 

 

Drawing image in Footer

Image can be inserted in header or footer using DrawImage method.

C#

 

 

Sample:

WPF Sample

WinRT Sample

UWP Sample

ADD COMMENT
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.

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