System Out Of Memory Exception while Exporting to Excel

2 posts, 0 answers
  1. Lithin
    Lithin avatar
    2 posts
    Member since:
    Sep 2018

    Posted 08 Nov 2018 Link to this post

    Hi ,

    The telerik version we are using is : 2016.1.225.45.

    We are facing an out of memory exception while trying to export close to 200k records using Telerik spreadsheet. 

    The for each loop snippet shown below executes for each of the 200k records.It is taking more than 5 mins. Is there any way to reduce the time consumption ?

     Dim currentRow As Integer = 6
            For Each row As DataRow In data.Rows
                sheet1.Cells(currentRow, 0).SetFormat(New CellValueFormat("@"))
                sheet1.Cells(currentRow, 0).SetValue(Convert.ToString(row("ClientID")))
                sheet1.Cells(currentRow, 0).SetIsWrapped(True)
                sheet1.Cells(currentRow, 1).SetFormat(New CellValueFormat("@"))
                sheet1.Cells(currentRow, 1).SetValue(Convert.ToString(row("ShortName")))
                sheet1.Cells(currentRow, 1).SetIsWrapped(True)
                sheet1.Cells(currentRow, 2).SetFormat(New CellValueFormat("@"))
                sheet1.Cells(currentRow, 2).SetValue(Convert.ToString(row("KnowledgeCategory")))
                sheet1.Cells(currentRow, 2).SetIsWrapped(True)
                sheet1.Cells(currentRow, 3).SetFormat(New CellValueFormat("@"))
                sheet1.Cells(currentRow, 3).SetValue(Convert.ToString(row("AuthoredBy")))
                sheet1.Cells(currentRow, 3).SetIsWrapped(True)
                sheet1.Cells(currentRow, 4).SetFormat(New CellValueFormat("@"))
                If IsDBNull(row("AuthoringDate")) Or String.IsNullOrEmpty(row("AuthoringDate").ToString()) Then
                    AuthoringDate = ""
                    AuthoringDate = Convert.ToDateTime(row("AuthoringDate")).ToString("dd/MM/yyyy")
                End If
                sheet1.Cells(currentRow, 4).SetValue(AuthoringDate)
                sheet1.Cells(currentRow, 4).SetIsWrapped(True)
                sheet1.Cells(currentRow, 5).SetFormat(New CellValueFormat("@"))
                sheet1.Cells(currentRow, 5).SetValue(Convert.ToString(row("IndustryName")))
                sheet1.Cells(currentRow, 5).SetIsWrapped(True)
                If ChangeType <> "Deleted Records" Then
                    sheet1.Cells(currentRow, 6).SetFormat(New CellValueFormat("@"))
                    sheet1.Cells(currentRow, 6).SetValue(Convert.ToString(row("TranslationChange")))
                    sheet1.Cells(currentRow, 6).SetIsWrapped(True)
                    sheet1.Cells(currentRow, 7).SetFormat(New CellValueFormat("@"))
                    sheet1.Cells(currentRow, 7).SetValue(Convert.ToString(row("Comment")))
                    sheet1.Cells(currentRow, 7).SetIsWrapped(True)
                    sheet1.Cells(currentRow, 6).SetFormat(New CellValueFormat("@"))
                    sheet1.Cells(currentRow, 6).SetValue(Convert.ToString(row("Comment")))
                    sheet1.Cells(currentRow, 6).SetIsWrapped(True)
                End If

                currentRow = currentRow + 1

    Also while exporting the worksheet, an out of memory exception is thrown. Please provide some help over the issue.





  2. Anna
    Anna avatar
    136 posts

    Posted 13 Nov 2018 Link to this post


    Have you had the chance to check out our SpreadStreamProcessing library? it is specifically designed to be fast and memory-efficient in scenarios that are limited to creation and export of files. If this case does not involve import and editing, I believe this library should do the trick. You can find the link to the documentation here:

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top