This is a migrated thread and some comments may be shown as answers.

Export to excel gives out of memory exception

1 Answer 129 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eli
Top achievements
Rank 1
Eli asked on 12 Apr 2013, 03:52 PM
Hello,

I am using version 2012.3 and am trying to export a RadGridView to excel. The data table is very large, over 1bil cells, and when I try to export to excel I get an out of memory exception.

The project can only be deployed as an x86 platform application. I included the code below, how can I export a large table in this application?


Thank you,
Eli

SaveFileDialog dialog = new SaveFileDialog();
string extension = "xml";
dialog.DefaultExt = extension;
dialog.Filter = string.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "ExcelML");
dialog.FilterIndex = 1;
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string exportString = radGridView.ToExcelML();

using (Stream stream = dialog.OpenFile())
{
byte[] bytes = Encoding.UTF8.GetBytes(exportString);
stream.Write(bytes, 0, bytes.Length);
}
}

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 15 Apr 2013, 02:51 PM
Hello,


Generally all the data to be exported is saved in memory, so the exporting capacities are not huge.

For more complex scenarios I would recommend you to use our Reporting tools which are built to suit various exporting scenarios. 

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Eli
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or