While exporting a huge data to excel it consumes more than 1GB memory (RAM) on my machine. And finally I gets "Out of memory exception".
Is there any way by which we can release some memory while exporting to excel?
Will ExportCache.Clear() solve the problem? If yes, how can we call it because ExportCache is a private property in DataPresenterExcelExporter class?
I am already done with setting ExportOptions. Is there any other way to get it done?
Any help is very much appreciated.
Hi,
I'm looking into this for you and I’ll post back here as soon as I have more information.
Would you be able to provide a description of the data that you are exporting, how many columns and rows or perhaps a sample that demonstrates the data that you are creating? If you’re using a viewmodel to load the grid and the code to generate the data, that would be very helpful.
I have built my own sample but it doesn’t generate sufficient data to match your description.
Hi Marianne,
Thanks for looking into it.
I am getting the data directly from Database . Being a business related data it is confidential so I can't share that with you any Sample or so. Although I can tell you details of the data as:Number of Rows: 0.2 MillionNumber of Columns: >50
I would suggest you to generate a datasource of 0.2M rows and 50 columns. You can create a datatable with 50 or more columns e.g., Col1, Col2 and so on. Then you can populate them in a For loop for 0.2M records.
While loading this into Grid will consume >256MB. Once you start exporting this to Excel it will start increasing significantly and will reach out to > 1GB in 4 mins. In few seconds you will see "Out of Memory" exception.
I hope this will solve your queries. Please let me know if any more information is required from my side.
Regards,Vikas
Hi Vikas,
Thanks for the information. I’ll modify my sample data as you described and we’ll go from there.
I’ve consulted with our development staff concerning this behavior and I am now in the process of logging this as a development issue. I am also creating a case for you so that we will be able to update you on our progress more directly.
You will hear from me shortly thru that case.
I am facing the same issue. Is there any solution?
Can you please update if there is any further release that fixed this issue?
Thanks.
Here is the stack trave of OutOfMemoryException on exporting a huge data (1M rows, 6columns) using DataPresenter.
tack : at System.Collections.Generic.Dictionary`2.Resize() at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Infragistics.Excel.WorksheetCell.set_CellFormatProxy(WorksheetCellFormatProxy value) at Infragistics.Excel.WorksheetCell.get_CellFormatInternal() at Infragistics.Windows.DataPresenter.ExcelExporter.DataPresenterExcelExporter.SetRegionRelativeToOrigin(DataPresenterExcelExporterHelper exportHelper, Rectangle rect, Object val, IWorksheetCellFormat cellFormat) at Infragistics.Windows.DataPresenter.ExcelExporter.DataPresenterExcelExporter.WriteSingleRecord(DataPresenterExcelExporterHelper exportHelper, Record record, FormatSettings cellFormatSettings) at Infragistics.Windows.DataPresenter.ExcelExporter.DataPresenterExcelExporter.ProcessSingleRecord(DataPresenterExcelExporterHelper exportHelper, Record record, Int32 nestingOffset) at Infragistics.Windows.DataPresenter.ExcelExporter.DataPresenterExcelExporter.ProcessRecordInternal(DataPresenterExcelExporterHelper exportHelper, Record record, ProcessRecordParams processRecordParams) at Infragistics.Windows.DataPresenter.ExcelExporter.DataPresenterExcelExporterHelper.ProcessRecord(Record record, ProcessRecordParams processRecordParams) at Infragistics.Windows.DataPresenter.DataPresenterExportControl.OnTraverseRecord(Record record, Visibility visibility, RecordManager recordManager, IExportOptions options, List`1 flattenedList, Boolean& skipSiblings) at Infragistics.Windows.DataPresenter.DataPresenterExportControlBase.TraverseVisibleRecords(ViewableRecordCollection records, RecordManager recordManager, IExportOptions options, List`1 flattenedList) at Infragistics.Windows.DataPresenter.DataPresenterBase.Export(IDataPresenterExporter exporter, IExportOptions options) at Infragistics.Windows.DataPresenter.ExcelExporter.DataPresenterExcelExporter.Export(DataPresenterBase dataPresenter, Worksheet worksheet, Int32 startRow, Int32 startColumn, ExportOptions options) at Infragistics.Windows.DataPresenter.ExcelExporter.DataPresenterExcelExporter.Export(DataPresenterBase dataPresenter, WorkbookFormat workbookFormat, ExportOptions options)
This issue was resolved in a service release of NetAdvantage for WPF Line of Business 2011 Vol. 1.
Please let me know if you have applied the latest service release and are still having issues.