Free Support Forum - aspose.com

Combining or AddCopy Out of Memory exception

I just updated Aspose.Total for .Net, I have this problem before and after the update.
I am using the Aspose 2.0 dlls

I am opening an excel workbook with one sheet called “Temp” which is my template.
I then want to copy it a few times to make copies in the same workbook, then close and save the workbook.

However about the third time I call wb.Worksheets.AddCopy(“Temp”) , I get an out of Memory Exception.

I also tried converting this to open the work book multiple times and them use Workbook.Combine(), and I also get an out of memory exception doing that.

The workbook is only about 10KB, and I have commented out the actual data writing procedures, so there shouldn’t be lots of memory used data-wise.

I am using Aspose.Cells in an ASP.Net development environment.

What am I doing wrong?

I was able to create a list and then use Aspose.Pdf.Kit to combine pdfs.

I traced the problem down to this line however,
ws.Cells.CreateRange(“F:I”).ApplyStyle(dollars, flagCustom);

This operation is expensive for Aspose, I assume because it is formatting every cell in the columns??

It does not run out of memory if I change the line to a limited rowset as shown below.
ws.Cells.CreateRange(“F7:I27”).ApplyStyle(dollars, flagCustom);

I believe this behavior is different than the Interop behaviour for formatting entire columns.

Hi,

Thanks for your interest in Aspose.Cells.

Please try the latest version Aspose.Cells
for .NET v6.0.1.1
and give us your feedback.

If the problem does not vanish, then please provide me your sample C# project replicating the problem or complete source code.