Hello Aspose support. I have some code that is populating a large excel workbook. It is running extremely slow. Every time I break into the code it's setting the style on cells, so that is definitely the bottleneck.
My code is doing a bunch of stuff in a loop and for each row it's getting a range of cells on that row and setting a specific style. I'm wondering what the fastest way to do this is?
Currently the code is looping through all the cells in the range, getting each cell with worksheet.Cells[Row, Column], and then setting the style property on each cell. In this version of the code, the bottleneck is actually looking up the cell in the loop (e.g. each time I break it's on the Cells call, not on the application of the style property).
I thought maybe it would be faster to do this with ranges so instead of looping through individual cells I tried worksheet.Cells.CreateRange() and passed in the range of cells. I then set the style on the range. This seemed significantly slower than my first approach. Strangely, the slowness was on the application of the style, not on the CreateRange() call. I didn't try the applystyle method but I assume it will be as slow.
Can you recommend a way to speed up this extremely slow operation? Currently we are using the first approach I describe, and just the call to Cells in the loop is very slow (obviously for a large number of cells). Thank you.