Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
205
Writing Excel Workbook with Large data - Out of Memory?
posted

Version: Infragistics.Documents.Excel V12.2 as Excel2007 format

Scenario:

In our trading app, there is a requirement to save all application related data (All Screens in the app) to be saved onto an Excel file so that the users can refer to it at a later date as to what data was exactly used for valuation and if required change it re-run it through the application to see the results.

So the output file cant be any other format other than excel as per the requirement.

So to save the application data, we use the Workbook object, create worksheets and add data by looping through the data object and set the cell value of the worksheet.

Problem:

Some of the screens in the application contain trade sensitivities data which is around approx 700 thousand rows which need to be written to the excel worksheet.

The issue we face is that the Workbook object contains all the worksheets and the Workbook.Save() method requires all sheets to be in the workbook object at the point of save, we get a out of memory exception when writing the huge number of records.

We are not able to write sheet by sheet to the workbook by subsequently clearing the worksheets.

Is there a way to get around this issue by not having all the worksheets in the workbook to be able to save or can we append worksheets to an existing file?

Please suggest a way out to deal with out of memory issue in this case.

Parents Reply Children