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

Export Excel

Hi,
I am using Grid Data Bound Grid. I am trying to export data to Excel. Please resolve the problem ASAP.

Cheers
Tannearu Gupta

6 Replies

AD Administrator Syncfusion Team November 29, 2006 05:52 AM UTC

Hi Tannearu,

XlsIO libraries are used to support the conversion of grid contents to excel. The dlls that these depend are Syncfusion.XlsIO.Base and Syncfusion.GridConverter.Windows

Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl();

The code to include both the headers during export is given below.

gecc.GridToExcel(this.gridDataBoundGrid1.Model, "YourFileName", ConverterOptions.RowHeaders,ConverterOptions.ColumnHeaders) ;

The code to exclude headers during export is given below.

gecc.GridToExcel(this.gridDataBoundGrid1.Model, saveFileDialog.FileName);


Please refer to the following sample which demonstrates the excel export in a grid.
http://www.syncfusion.com/Support/user/uploads/GDBGExport_fecc01cd.zip

Best Regards,
Haneef


TH Tannearu Hazarathaiah Gupta November 29, 2006 06:57 AM UTC


Hi Haneef,
Thanks For your response. Its not working. Its exported Data. Its exporting only data. I nedd Columns Hedader should display. I add following code. Please check it once.

Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl();
gecc.GridToExcel(this.gridDataBoundGrid1.Model, "c://Hazar/hazar3.xls", Syncfusion.GridExcelConverter.ConverterOptions.ColumnHeaders );


Please check it once and response me.

I am waiting for your reply.


Regards
Tannearu
>Hi Tannearu,

XlsIO libraries are used to support the conversion of grid contents to excel. The dlls that these depend are Syncfusion.XlsIO.Base and Syncfusion.GridConverter.Windows

Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl();

The code to include both the headers during export is given below.

gecc.GridToExcel(this.gridDataBoundGrid1.Model, "YourFileName", ConverterOptions.RowHeaders,ConverterOptions.ColumnHeaders) ;

The code to exclude headers during export is given below.

gecc.GridToExcel(this.gridDataBoundGrid1.Model, saveFileDialog.FileName);


Please refer to the following sample which demonstrates the excel export in a grid.
http://www.syncfusion.com/Support/user/uploads/GDBGExport_fecc01cd.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team November 29, 2006 07:19 AM UTC

Hi Tannearu,

Thanks for the update.

Try this code to export the grid data with column header.

Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl();

//ConverterOptions.RowHeaders enumeration for exporting the columnheader in a grid.
gecc.GridToExcel(this.gridDataBoundGrid1.Model, "FileName",Syncfusion.GridExcelConverter.ConverterOptions.RowHeaders);

Best Regards,
Haneef


TH Tannearu Hazarathaiah Gupta November 29, 2006 08:49 AM UTC

Hi haneef,
Thanks for your update. Its working.


Regards
Tannearu

>Hi Tannearu,

Thanks for the update.

Try this code to export the grid data with column header.

Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl();

//ConverterOptions.RowHeaders enumeration for exporting the columnheader in a grid.
gecc.GridToExcel(this.gridDataBoundGrid1.Model, "FileName",Syncfusion.GridExcelConverter.ConverterOptions.RowHeaders);

Best Regards,
Haneef


HG Hema Gunda December 15, 2010 03:25 PM UTC

Is the same valid for Silverlight?
I am using Syncfusion 8.2.0.18 for Silverlight 3.5.
I have used the same code but in vain.
Could you suggest?

Thanks in advance.



MS Mohamed Suhaib Fahad A. Syncfusion Team December 21, 2010 03:56 PM UTC

Hi Hema,

For WPF / Silverlight we have a different API and assemblies to refer to, Please check the below UG link,

http://help.syncfusion.com/ug_84/User%20Interface/WPF/Grid/default.htm?turl=Documents/exportinggdctoexcel.htm

Also, we have stopped support for Silverlight 3.0 FW and only support for Silverlight 4.0 in VS2010. Any bugs or feature enhancements would be done in this version alone.

Please let us know if you need any more assistance.

Thanks,
Fahad


Loader.
Live Chat Icon For mobile
Up arrow icon