Exporting Large Number of Items Throws rowIndex Out of Bound Exception

2 posts, 0 answers
  1. Ahmed
    Ahmed avatar
    16 posts
    Member since:
    May 2014

    Posted 06 May 2016 Link to this post


    I have a gridview contains 2+ Millions rows and around 5 columns, I want to export the gridview as Excel or PDF document. When call export, I get rowIndex out of bound exception.

    Here is the way I used to export as Excel

    exportGridView.ExportToXlsx(stream, new GridViewDocumentExportOptions
                                                                                                     AutoFitColumnsWidth = true,
                                                                                                     ExportDefaultStyles = true,



    and this is the way I export as PDF

    exportGridView.ExportToPdf(stream, new GridViewPdfExportOptions
                                                                                                    AutoFitColumnsWidth = true,
                                                                                                    ExportDefaultStyles = true,


    Best regards,


  2. Stefan Nenchev
    Stefan Nenchev avatar
    665 posts

    Posted 10 May 2016 Link to this post

    Hello Ahmed,

    As all data that is about to be exported is saved in memory, there is a certain limitation of the total amount of items that you can export. I suggest you check the Reporting tools for scenarios where a huge amount of data needs to be exported. You can also consider some custom logic to export the grid in parts and in separate files.

    Stefan Nenchev
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top