Workbook.Save() throws an exception for large dataset

Hi,

I got an exception in Workbook.Save(). It only happens when I save large amount of data to Excel. This one is 65000+ rows in each tab and more than 3 tabs. Any idea on what the problem would be?

Besides, the aspnet_wp memory consumption went to 1.4GB when I ran this Excel. Is this normal?

Thanks.

Miao

Hi,

When you fill 65k+ rows with certain number of columns in a single worksheet, huge amount of memory would be required and the process would be very slow as well. The file generated by this process would have huge size too. I think you may try to the following options.

1). Try to reduce the size of your file splitting a single file into multiple files.

2). Try to split your dataset into multiple worksheets instead of a single worksheet.

Thank you.

Thanks for the reply. This is the exception I received. It's OutOfMemory exception. Could you please tell me what the size limit is? The file we generate is about 60M big. Thank you!

ExcelBuilder:BuildExportFile()------ at System.IO.MemoryStream.set_Capacity(Int32 value)
at System.IO.MemoryStream.EnsureCapacity(Int32 value)
at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at Aspose.Cells.Cells.xc26afd5362f5c1ec(xaae832abae2edf07 xcf18e5243f8d5fd3, FileFormatType xab59d5b558cd3dde)
at Aspose.Cells.Worksheet.xc26afd5362f5c1ec(xaae832abae2edf07 xcf18e5243f8d5fd3)
at Aspose.Cells.Worksheets.x668135b31fe5c8d9(xaae832abae2edf07 xcf18e5243f8d5fd3)
at Aspose.Cells.Worksheets.x806178efa0bb6fcf(FileFormatType xab59d5b558cd3dde)
at Aspose.Cells.Workbook.Save(Stream stream, FileFormatType fileFormatType)
at Aspose.Cells.Workbook.Save(String fileName, FileFormatType fileFormatType)
at Shepherd.Platform.Services.Export.ExcelReport.Save(String fileName, FileFormatType fileFormatType)
at Shepherd.Platform.Services.Export.ExcelBuilder.BuildExportFile(UserContext userContext, ExportContext ec, ExportPolicy ep)----Exception of type 'System.OutOfMemoryException' was thrown.

Hi,

Thanks for considering Aspose.

No, there is no file size limit related to Aspose.Cells for Java but there is certain size and memory limit for JVM. So, you do need to extend the memory utilized for your JVM to process the task. I think you may try to use JVM option e.g.., -Xmx512 to allow more memory available for JVM when you run your program because your template is a huge one which need memory to read the file.

Thank you.

Thanks for the info! We are using aspose.cells for .NET and the website is running on IIS6.

Have you seen any problems like this before? Any comments? It may not be an aspose issue at all but I just want to get some suggestions from you. Thanks a lot!

Miao

Hi Miao,

Sorry for my mistake, please disregard my previous post for I thought you are using Aspose.Cells for Java.

Aspose.Cells for .NET can create huge files over 100M and there is no size limit. But I think if you are creating huge files, huge amount of memory would be need and the process can take lots of time.

So it is recommended that you should try any option what I have suggested before:

1). Try to reduce the size of your file splitting a single excel file into multiple excel files.

2). Try to split your dataset into multiple worksheets instead of a single worksheet.

Thank you.