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.

Export to Excel

Thread ID:

Created:

Updated:

Platform:

Replies:

95491 Jul 13,2010 04:18 AM Sep 21,2010 05:32 PM Silverlight 6
loading
Tags: GridControl
Faizal Ahmd
Asked On July 13, 2010 04:18 AM

I am using the silver light syncfusion grid. I want to export the grid contents to excel.But grid.model.exporttoexcel funtion is not enabled for me.Any help would be appreciated

Kamalakannan A [Syncfusion]
Replied On July 24, 2010 05:06 PM

Hi Fizal,

You need to add the following namespace to call the method "Model.ExportToExcel(ExcelVersion.Excel97to2003)".

Namespace : Syncfusion.Windows.Controls.Grid.Converter;

Let us know if you need any more information.

Thanks
Kamalakannan

Tigger Tag
Replied On August 27, 2010 11:14 AM

Hi,

Model.ExportToExcel(ExcelVersion.Excel97to2003) function is opening File Save Dialog box, How do I get the Stream from the ExportToExcel function and not display the File Save Dialog box.

Thanks,

Tigger Tag
Replied On August 30, 2010 11:12 AM

Hello,
Can anyone answer my question, I want to export the grid data in Excel format, I want to get the Stream object for the export method and not the current File Save As Dialog that creates excel file on the client machine. I have a requirement to store the grid data (with excel like formatting) into a database column and display the same at a later stage. This is a make or break feature for the prototype project I am developing. I would appreciate if you could give a quick solution so that we could make the decision.

Thanks in advance.

Kamalakannan A [Syncfusion]
Replied On September 7, 2010 08:43 AM

Hi Tigger,

Thank you for using Syncfusion products.

Grid can be exported to excel without save dialog box using grid.ExportToExcel() method.

Please refer the sample in the following link

Sample: http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=sample944676633.zip

Let us know if any queries.

Thanks
Kamal.



Tigger Tag
Replied On September 14, 2010 03:03 PM


Is there a way to export to Excel to a Stream (like Memory Stream) instead of specifying a file name? I want to store the excel file in the database instead of a file. The sample you attached shows me how to save it to a file without showing the dialog box, if I am able to get a Memory Stream out of it would be great.

Thanks,


Kamalakannan A [Syncfusion]
Replied On September 21, 2010 05:32 PM

Hi Fizal,

Thanks for your update.

Silverlight Grid Control does not export the underlying source as a collection to an object. This can be achieved only by defining an object for the underlying source class and collect the cell values to the object using grid model as follows.

[Code snippet] [C#]

private void Exportbutton_Click(object sender, RoutedEventArgs e)
{
List Source = new List();
GridModel Gridmodel = this.grid.Model;
for (int i = 0; i < grid.Model.RowCount; i++)
{
griddata rowdata = new griddata();
rowdata.col1 = Gridmodel[i, 0].CellValue.ToString();
rowdata.col2 = Gridmodel[i, 1].CellValue.ToString();
Source.Add(rowdata);
}
}

Please find the attached sample for your reference.

Sample: Silverlight_GridControl1404564019.zip

Let us know if you need any more information.

Thanks
Kamalakannan




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.

;