This project has moved and is read-only. For the latest updates, please go here.

NumberFormat for string as text performance

Oct 16, 2012 at 12:33 PM

We are generating around 7000 rows and 81 columns in one of our reports. The problem is performance, it is taking quite a lot of time generating the report and upon analysis, it was found that most of time is being spent on setting NumberFormat. We are using following code to set the format for string columns as text for each column of type string.

ExcelNumberFormat.Format = "@"

Further digging down, we found out most of time is being spent in
OfficeOpenXml.RangeCollection.Insert(int ix, IRangeId cell)

Below is the stack trace for further information.

Could someone please help?

Oct 18, 2012 at 9:23 PM


Make sure you set cells from left to right, top to bottom. That means, access all cells in the sheet starting from A1-->XX1-->XX7000.

(setting all cell related properties, like style, formula will create a new cell and forcing a copy in the internal indexetc.)

Read the FAQ for futher info