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 GridControl to Excel

Hi,

I want to export gridcontrol to a excel file, how can i do it???

Thanks,
Surti

PD: I work in VB.net with GridControl version 1.5.1.1

6 Replies

AD Administrator Syncfusion Team January 4, 2007 12:22 PM UTC

Hi Surti,

We have built-in support for exporting the grid to excel in Essentail Grid version 4.x . The shipped ExcelExport_DataBoundGrid Browser sample ( \Syncfusion\Essential Studio\4.4.0.49\windows\Grid.Windows\Samples\Serialization\ExcelExport_DataBoundGrid\ ) hows you how to export the grid data into Excel. Please download the latest verison and let us know if you still run into any issues.

Thanks for choosing and using Syncfusion Products.

Best Regards,
Haneef

Note : There is no built-in for exporting the grid to excel in Essential Grid version 1.5.1.1


GA Ganesh February 26, 2007 07:39 AM UTC

HI,

I want to export selected rows with the styles from the GridControl to the excel sheet not all the rows. How can i do that?

Thanks in Advance
Regards
Ganesh


AD Administrator Syncfusion Team February 26, 2007 06:12 PM UTC

Hi Ganesh,

Here is a minimal sample that shows you "How to export the selected cell ranges with column header in the grid to excel?". Please try the attached sample and let me know if this helps.

sample : GDBGExportRowHeader.zip

Best regards,
Haneef


GA Ganesh February 27, 2007 05:14 PM UTC

Hi Haneef...

Thanks a lot. I am able to do the export for the selected rows. In this i think we are exporting cell by cell manually. I have one issue in this. I have some set of rows merged for few coloumns. so when i export it doesnt merge those columns..Any suggestion for this?
Thanks in Advance
Ganesh

>Hi Ganesh,

Here is a minimal sample that shows you "How to export the selected cell ranges with column header in the grid to excel?". Please try the attached sample and let me know if this helps.

sample : GDBGExportRowHeader.zip

Best regards,
Haneef


GA Ganesh February 27, 2007 05:37 PM UTC

Hi Haneef... I have already used this solution and facing this problem.. so please let me know any work around available for that.
Thanks in Advance
Ganesh

>Hi Haneef...

Thanks a lot. I am able to do the export for the selected rows. In this i think we are exporting cell by cell manually. I have one issue in this. I have some set of rows merged for few coloumns. so when i export it doesnt merge those columns..Any suggestion for this?
Thanks in Advance
Ganesh

>Hi Ganesh,

Here is a minimal sample that shows you "How to export the selected cell ranges with column header in the grid to excel?". Please try the attached sample and let me know if this helps.

sample : GDBGExportRowHeader.zip

Best regards,
Haneef


AD Administrator Syncfusion Team February 27, 2007 09:55 PM UTC

Hi Ganesh,

You can call the CopyMergesFromGrid method after calling the ExportColumnHeaders method. Here is a code snippet.

private void CopyMergesFromGrid( GridModel grid, IWorksheet sheet)
{
GridModelCoveredRanges coveredRanges = grid.CoveredRanges;
GridRangeInfoList ranges = grid.CoveredRanges.Ranges;
for( int i = 0, len = ranges.Count; i < len; i++ )
{
GridRangeInfo rangeInfo = ranges[ i ];
string strMessage = string.Format( "({0}, {1})-({2}, {3})", rangeInfo.Top, rangeInfo.Left, rangeInfo.Bottom, rangeInfo.Right );
if( rangeInfo.Top == 0 || rangeInfo.Left == 0 ) continue;
sheet.Range[ rangeInfo.Top, rangeInfo.Left, rangeInfo.Bottom, rangeInfo.Right ].Merge();
}
}

Please refer to the attached sample for more details and let me know if this helps.
GDBGExportRowHeader.zip

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon