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

Free Support Forum - aspose.com

Advice on efficiency - Inserting Rows and Columns

I have a product where I’m collecting data from a database and, after some massaging, plotting the data into excel via Aspose’s Cell.

One of the largest bottlenecks I have right now is the amount of time it takes for the InsertColumn or InsertRow to execute.
The code executes in this fashion:

foreach (output item in masterList)
Find out which line is my starting point and plot the values for each column (IE: data needs to be plotted at row 6, start there, do B6, C6, D6)
If we’re bursting data, we need to insert a row at B6 and plot the data again.

Repeat for the loop about 3 thousand times.
If more information is needed, I would be glad to provide it.
I’m looking for advice on how I may optimize this process.

Thanks,

Greg

Hi,


Well, as you are inserting long list of data into the cells in rows thousands times, this will surely take time and lots of memory would be consumed for the big process. I am afraid, there is no better way to cope with it. May be a better option is to use InsertRows/InsertColumns method(s) (if possible) instead of InsertRow/InsertColumn method(s). Also as you are importing data from Database (you may consider importing data to fill e.g DataTable on the fly etc.), so you may consider using Data Importing options provided by Aspose.Cells (you may use Cells.ImportDataTable(), Cells.ImportDataRow/Column, ImportArray() etc. which are more optimized or efficient methods), see the document for your reference:
http://www.aspose.com/docs/display/cellsnet/Importing+Data+to+Worksheets

Also in the new versions (e.g v8.0.x) we have provided the Memory Optimization Preferences option that you may utilize for reading/ writing Big Excel workbooks having large Dataset, see the document for your reference:
http://www.aspose.com/docs/display/cellsnet/Optimizing+Memory+Usage+while+Working+with+Big+Files+having+Large+Datasets


Thank you.