I am attempting to insert rows between existing rows within a worksheet. Each newly inserted row should have the cells within merged and have a text value.
I am basically calling the following in a loop on a very small spreadsheet (only 12 rows and 4 columns) and it is very slow. The spreadsheet originates from a call to grid.ExportToWorkbook().
worksheet.Rows.Insert(rowIndex, 1);
worksheet.Cells[rowIndex, 0].SetValueAsText("haha");
worksheet.Cells[new CellIndex(rowIndex, 0), new CellIndex(rowIndex, 3)].Merge();
Two issues:
Issue 1: This is very slow. Each call to insert takes a long time to execute. The entire operation takes several seconds despite only inserting 12 rows. I have suspended layout, put everything in a single undo group. The control isn't even visible at this point.
Issue 2: The cells do not seem to be merging correctly. Some of the values of non inserted rows are removed. If I comment out the call to merge, all values appear to be correct
Thanks in advance.