How to write large report with minimal memory using C#.NET

We’re using Aspose.Cells for .NET to generate large reports–on the order of 1 million rows. I’m using a SqlDataReader to stream data from SQL Server, which helps reduce memory usage. However, Aspose is still using up 500MB to 1GB of RAM. How do I reduce the memory usage? Perhaps some sort of batching? I am already outputting to a Stream. I tried calling Workbook.Save to push the data in memory to the stream, but there is no effect.

The version I’m using, based on the .lic file, is 2.2. Additional data on request.

Hi,


Please download and try our latest fix: Aspose.Cells for .NET v7.5.0.2

And, do you use ImportDataTable method to import data (after filling into dataset/datatable from SQL Server using ADO.NET APIs by using your own code)? If not, please use this method for Cells class, the method is efficient to do the task. But since your records are 1 million to be imported into the worksheet, so this big process would surely demand more memory and resources. Also when the final file is saved, it would be larger sized and even MS Excel would take some time to open into it.

By the way, we have LightCells APIs and if you are only filling data from a data source into a new workbook, you may work in light cells mode, see the topic for your reference:

I have also attached a sample project that you may refer to it.

Thank you.

I am not using the ImportDataTable method; since the rows are read from the SqlDataReader one at a time, there is never a DataTable object in use.

I will look at the LightCells API. Thank you.