We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Import huge datatable

Thread ID:

Created:

Updated:

Platform:

Replies:

99222 May 9,2011 08:04 AM UTC May 9,2011 12:33 PM UTC Windows Forms 1
loading
Tags: XlsIO
Ronan Smits
Asked On May 9, 2011 08:04 AM UTC

I'm trying to import a huge datatable (408000 records, 18 fields per record) but I'm getting an "OutofMemory Exception" each time I try to do that.

This is the code I used

ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;

IWorkbook workbook = application.Workbooks.Create(1);
workbook.Version = ExcelVersion.Excel2010;
IWorksheet sheet = workbook.Worksheets[0];

sheet.ImportDataTable(datatable, false, 2, 1, true);

workbook.SaveAs(filename);
workbook.Close();
excelEngine.Dispose();

I also tried to manually import the datatable with a foreach statement, but then I get the OutOfMemory error around row 138000.


Sridhar [Syncfusion]
Replied On May 9, 2011 12:33 PM UTC

Hi Ronan,

Thank you very much for using Syncfusion products.

In Essential XlsIO, we will be using the system memory for content preservation until it is save to the file .If we are dealing with large amount of data, the XlsIO component requires more system memory to preserve the details. In order to avoid such reported exceptions our existing object model requires more changes. We have already logged a feature report for the same and it will implemented in our forth coming releases. We highly regret for the inconvenience.

The ImportDataTable is best one to import the data then importing the data using foreach loop.


Please let us know if you need any clarifications.

Thanks,
Sridhar.S




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;