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.
Unfortunately, activation email could not send to your email. Please try again.

exporting data to excel

Thread ID:

Created:

Updated:

Platform:

Replies:

73584 May 12,2008 08:24 AM May 14,2008 05:33 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On May 12, 2008 08:24 AM

Hello,
I am trying to export data from GridGrouping control to excel. while exporting I want my grid columns to be exported iin a paticular order while the order of columns in grid should not change.Is it possible?????
Or can i Export a datatable to excel ????
If both are not possible kindly suggest a way to overwrite data for a particu;ar column in the excel sheet created by exporting data from gridcontrol.Quick response will be highly Appreciated.

Thanks in advance
Ranju Malhotra


Administrator [Syncfusion]
Replied On May 14, 2008 05:33 AM

Hi Ranju,

You can a export a Datatable to the excel. Please refer the following code snippet that shows how we can export a Datatable to te Excel.


private void Export_Click(object sender, System.EventArgs e)
{
Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl converter = new

Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl();

SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Files(*.xls)|*.xls";
saveFileDialog.DefaultExt = ".xls";

if(saveFileDialog.ShowDialog() == DialogResult.OK)
{
if(radioButton1.Checked)
converter.GroupingGridToExcel(this.gridGroupingControl1, saveFileDialog.FileName,
Syncfusion.GridExcelConverter.ConverterOptions.Visible);
else if(radioButton2.Checked)
converter.GroupingGridToExcel(this.gridGroupingControl1,

saveFileDialog.FileName,
Syncfusion.GridExcelConverter.ConverterOptions.Default);

if(MessageBox.Show("Do you wish to open the xls file now?", "Export to Excel",

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Process proc = new Process();
proc.StartInfo.FileName = saveFileDialog.FileName;
proc.Start();
}
}
}


Please refer the following sample in the below link that illustrates the above.

http://websamples.syncfusion.com/samples/Grid.Windows/F73584/main.htm


You can also refer the GridExport sample :

\\Syncfusion\EssentialStudio\5.2.0.25\Windows\Grid.Grouping.Windows\Samples\2.0\Serialization\Excel Export\


Regards,
Asem.



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.

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.

;