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 export the contents of a grid to Excel?

You can transfer the contents of the GridControl and GridDataBoundGrid to Excel by using the GridToExcel method of the GridExcelConverter class. Here is the code example.



C:\Users\ApoorvahR\Desktop\Note.pngNote: The following dll files should be added, along with the default dll files in reference folder: Syncfusion.GridConverter.Base, Syncfusion.GridConverter.Windows, Syncfusion.XlsIO.Base

Sample Links

CS: Exporting

VB: Exporting

Article ID: Published Date: Last Revised Date: Platform: Control:
4094 02/18/2015 02/12/2016 WinForms GridDataBoundGrid(Classic)
Did you find this information helpful?
Nilofer Jun 10, 2015
How do we autofit the excel sheet columns? ConverterOptions doen't take more than one options how do we add more than options like say ConverterOptions.ColumnHeaders as well as ConverterOptions.Visible
Venkatesh Sundaram [Syncfusion] Jun 12, 2015
Hi Nilofer , Thanks for your update. We have analysed your reported scenario. We have provided the solution as below, Query 1: The “AutoFit” can be done by using the Autofitcolumns property. but this property is not working on the current version of the release and this problem can be resolved by the developer on upcoming release. If you want to get the patch, you can contact the engineer through the DirectTrac. Please refer the below code snippet. CodeSnippet[C#]: excelExport.AutoFitColumns = true; Query 2: We can use ‘|’ operator to have multiple ConverterOption while exporting.Please refer the below code snippet. CodeSnippet[C#]: Syncfusion.GridExcelConverter.GridExcelConverterControl excelExport = new Syncfusion.GridExcelConverter.GridExcelConverterControl(); excelExport.GridToExcel(this.gridControl1.Model, sheet, Syncfusion.GridExcelConverter.ConverterOptions.ColumnHeaders | Syncfusion.GridExcelConverter.ConverterOptions.Visible); Sample Link: http://www.syncfusion.com/downloads/support/directtrac/123233/ze/CS-339965915 http://www.syncfusion.com/downloads/support/directtrac/123233/ze/VB-405717033 please let us know if you have any concerns. Thanks and Regards, Venkat.
Add Comment
You must log in to leave a comment

Please sign in to access our KB

or the page will be automatically redirected to 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