We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

System.OutOfMemoryException using Aspose.Cells Version 7.0.4.0

Hi experts,


I am using Aspose.Cells Version 7.0.4.0 for .Net in one of my project.
When I am trying to read the large size excel files using Aspose.Cells.WorkBook, I am getting
Error: System.OutOfMemoryException

I am processing Excel Files (.xlsx) with size 38,000 KB and 52,000 KB i.e., around 100000 rows in excel.

string tempPath = strPath + @"" + fileType; //path from where I am reading the file (C drive)
foreach (string templateFile in Directory.GetFiles(tempPath))
{
using (FileStream fstream = new FileStream(templateFile, FileMode.Open))
{
Workbook workbook = new Workbook(fstream); //getting exception here
Worksheet worksheet = workbook.Worksheets[0];
ArrayList misMatchedColList = new ArrayList();

//other code

After reading the solutions on google, I tried to use code for ‘memory preferences’ :

// Specify the LoadOptions
LoadOptions opt = new LoadOptions();
// Set the memory preferences
opt.MemorySetting = MemorySetting.MemoryPreference; //not getting this option in my code.

I wonder ‘MemoryPreference’ is not available with this version of Aspose.Cells or available using other way round.

Kindly suggest some solution how to use ‘MemoryPreference’ with this version of Aspose.Cells so that I can process large size excel file without above error.

Hi,


Thanks for your posting and using Aspose.Cells.

If your file is large, then it will definitely take more processing time and more memory. Sometime, Excel file contains such objects like compressed images (.jpg, .png etc), when such things are uncompressed, then it also takes lots of memory.

For example 4 MB bmp image when compressed becomes 17-300 KB. Similarly, when it will be uncompressed, it will again become 4 MB.

The memory preference option is available in recent versions. Since, you are using the older version, we recommend you to download and try the latest version and check if it makes any difference in resolution of your issue. Let us know your feedback.

Latest Version Links:

Aspose.Cells for .NET v17.3.10 (.NET 2.0) compiled in .NET Framework 2.0.
Aspose.Cells for .NET v17.3.10 (.NET 4.0) compiled in .NET Framework 4.0.

Thank you for the reply.

Please note that User doesn't want to upgrade to any new version of Aspose.
Kinldy suggest some workaround using the same Version 7.0.4.0

Is there anyway I can use the 'MemorySetting.MemoryPreference' option to optimize memory using Aspose.Cells for Version 7.0.4.0 ?

I need some urgent solution to this. Any help would be much appreciated.
Thanks in advance

Hi,


We are very sorry but we cannot include features/APIs to older versions. The features and fixes can only be embedded in the latest version (latest APIs set) of the product. Furthermore, we cannot evaluate your issue in older version that you are using, nor we can fix any issue (if found) in older versions, the fixes are based on latest APIs set only.

In short, there is no way but to upgrade to latest APIs set of the product to give it a try to your scenario/case. And, if you find the issue in latest version/fix, we will try to resolve the issue (by logging it into our database) soon and provide you the fix or other way around in due time.

Thank you.