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?

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

Article ID: Published Date: Last Revised Date: Platform: Control:
5519 10/29/2015 01/14/2016 WPF SfDataGrid
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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