Export to excel gives out of memory exception

2 posts, 0 answers
  1. Eli
    Eli avatar
    34 posts
    Member since:
    Oct 2011

    Posted 12 Apr 2013 Link to this post


    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,

    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);
  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 15 Apr 2013 Link to this post


    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,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top