System.OutOfMemoryException when setting cell values

2 posts, 0 answers
  1. André
    André avatar
    1 posts
    Member since:
    Oct 2016

    Posted 23 May 2017 Link to this post



    I'm new to the SpreadSheet control, I have used the standard example WPF code to create it as a user control.

    Then I use this control in a RadWindow, and I want to add the data from DataTable from a database table with 72 columns and 110000 rows.

    I use a simple loop to do this, since I have understood that databinding is not possible with a datatable on the SpreadSheet control.

    When I try to load the data I get this message System.OutOfMemoryException.

    I have browsed these posts, and so I also limitted the number of visble rows and columns to 80 x 100 but without success.

    Can anyone tell me how I can do this correctly?


    Basically I already moved away from the RadGridView since the RadGridView can not save to a Xlsx anymore, and the files that are generated are either not recognized by excel, or take too long too open with Excel.

    So if anyone can give me a good way to export preferably with an intermediate grid, or otherwise a datatable to Excel in a Fast way, that keeps all the correct data types, and opens fast in Excel that would also be very helpfull. 







  2. Tanya
    Tanya avatar
    624 posts

    Posted 26 May 2017 Link to this post

    Hi André,

    First, I would like to mention that RadGridView can export to XLSX using its ExportToXlsx() method. I suggest that you have been using its old alternative, thus it is not working for you anymore. You can find information on how to export the data from the grid in the ExportToXlsx topic.

    I tested the scenario and noticed that the exception is thrown while generating a simple data table with a similar amount of data. With that said, seems like the memory allocated for the process of the application is not enough to accommodate the whole data. In addition, generating the model of RadSpreadsheet will need some resources to store the values and the properties of its objects. I am afraid that, due to the big amount of data and the limitations of the framework, there isn't much we can do to decrease the memory usage.

    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top