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 export the contents of a grid to excel in WinForms GridControl, GridGroupingControl and GridDataBoundGrid?

Platform: WinForms |
Control: GridDataBoundGrid(Classic)
Tags: exporting


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.


Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl();
//Convert Grid to the Excel


Dim gecc As New Syncfusion.GridExcelConverter.GridExcelConverterControl()
'Convert Grid to the Excel
gecc.GridToExcel(Me. gridDataBoundGrid1.Model,"D:\excel.xls")



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


C#: Exporting

VB: Exporting

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment
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 Reply
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. Reply

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