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.

Essential grid 5.2.0.25 - C# - .NET 2.0

Thread ID:

Created:

Updated:

Platform:

Replies:

73437 May 7,2008 02:58 AM May 13,2008 08:29 AM Windows Forms 2
loading
Tags: GridControl
Alain Nagels
Asked On May 7, 2008 02:58 AM

Hello


I have a grid with several columns.
I want to export this grid to Excel and every column has to come in a seperate sheet.
I must also keep the layout of the grid in the Excel file.

How can I do this in a very efficient way?

Thanks in advance.



Administrator [Syncfusion]
Replied On May 9, 2008 10:24 AM


Hi Alain,

There is no built-in support for this behavior. If you want to export the selected Column to excel, you need to derive the GridExcelConverterControl class and implement the SelectedRowExport method. Please refer the following code snippet.


private void button2_Click(object sender, System.EventArgs e)
{
Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl();

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

if(saveFileDialog.ShowDialog() == DialogResult.OK)
{
gecc.GridToExcel(this.gridDataBoundGrid1.Model, saveFileDialog.FileName,
Syncfusion.GridExcelConverter.ConverterOptions.RowHeaders);

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 sample in the below link that illustrates the above.

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

Regards,
asem.



Alain Nagels
Replied On May 13, 2008 08:29 AM

Hello Asem

Ok, thanks for your response.

Regards,

Alain




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.

;