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

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

6 Replies

KA Kamalakannan A Syncfusion Team July 24, 2010 09:06 PM UTC

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


TT Tigger Tag August 27, 2010 03:14 PM UTC

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,


TT Tigger Tag August 30, 2010 03:12 PM UTC

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.


KA Kamalakannan A Syncfusion Team September 7, 2010 12:43 PM UTC

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.




TT Tigger Tag September 14, 2010 07:03 PM UTC


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,



KA Kamalakannan A Syncfusion Team September 21, 2010 09:32 PM UTC

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




Loader.
Live Chat Icon For mobile
Up arrow icon