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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Export to pdf, excel and print

Thread ID:

Created:

Updated:

Platform:

Replies:

118444 Mar 9,2015 11:55 AM UTC Mar 10,2015 12:37 PM UTC ASP.NET Web Forms 1
loading
Tags: Grid
Dhirender
Asked On March 9, 2015 11:55 AM UTC

Hi, 

I'm using SyncFusion  grid control for ASP.NET. Please provide me a sample project to export the grid to pdf and excel along with the print functionality. I'd also like to add header and footer to that exported pdf. So kindly provide me a sample project for the same. 


Regards
Dhirender


Alan Sangeeth S [Syncfusion]
Replied On March 10, 2015 12:37 PM UTC

Hi Dhirender,

Thanks for using Syncfusion Products.

We have prepared a Grid Exporting sample based on your requirement and the same can be downloaded from below link.

Sample: http://www.syncfusion.com/downloads/support/directtrac/118444/Sample2030582165.zip

In the above sample for pdf exporting, we have added header and footer to the pdf document using “PdfPageTemplateElement”. Please refer the following code snippets.

protected void FlatGrid_ServerPdfExporting(object sender, Syncfusion.JavaScript.Web.GridEventArgs e)

        {

...

PdfPageTemplateElement footer = new PdfPageTemplateElement(rect);

PdfPageTemplateElement header = new PdfPageTemplateElement(rect);

...

footer.Graphics.DrawString("Custom Text - Footer", font, brush, rect, format); //Add custom text to the header

header.Graphics.DrawString("Custom Text - Header", font, brush, rect, format); //Add custom text to the footer

pdfdocument.Template.Bottom = footer; //Append custom template to the document

pdfdocument.Template.Top = header;

pdfdocument.Save("Export.pdf", Response, HttpReadType.Save);

Please refer the following UG document and online sample link for further reference on exporting.

Documentation: http://help.syncfusion.com/ug/js/documents/exporting3.htm

Online Sample: http://asp.syncfusion.com/demos/web/grid/excelexporting.aspx

Regards,
Alan Sangeeth S



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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

;