Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Performance of cell format setting in Infragistics.Documents.Excel.Workbook
posted

Hi,

We have some problems with setting the cell formatting on a rather large Excel workbook with multiple worksheets. We are creating a workbook to preview and export data from a model, and the model has quite a lot of data.

What we'd like to do, is to apply some formatting on some of the cells, according to the cell type. For instance, we would like to right align all numeric columns, and show some cells with bold font. Without formatting, the workbook is created in less than a second. When formatting is applied, it takes around 4 minutes, so the performance takes a pretty dramatic hit.

We can't set the formatting for rows or columns, since there may be several small data areas on the same worksheet, and their data may differ. So we are pretty much stuck with individual cells here. Cell regions could be a solution, but we could not find any way to set a style for a region of cells, that are not merged.

When setting the cell format, we first tried to apply the format for each cell using cell.CellFormat property directly. Then we tried to create a common style for each type of formatting (five separate styles were needed in this test case), and apply the existing style by calling cell.CellFormat.SetFormatting(). However, this did not speed the process up at all.

We call workbook.SuspendCalculations() at the start of the worksheet creation.

Could you provide any ideas about how to speed up the format setting?

Thanks in advance,
-Antti

Parents Reply Children
No Data