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

InsertRow freezes application.

Apr 9, 2013 at 4:57 PM
Edited Apr 9, 2013 at 4:58 PM
So I have have two decimal columns that I want to convert to a single combined statement: D1 x D2. The code for this is below, and it works perfectly the saved document is just what I want. But an issue showed up when I afterwards added in a call to InsertRow. The application just hangs there...no exceptions or anything...just sits. But, if I comment out the line with the formula everything works fine again.
// If I comment this out, InsertRow works normally.
ws.Cells[1, 2, currentRow, 2].Formula = string.Format(@"CONCATENATE(TEXT({0},""## #/#""), "" x "", TEXT({1},""## #/#""))", new ExcelAddress("H1").Address, new ExcelAddress("I1").Address); 

// Will just hang here if the above isn't commented.
ws.InsertRow(1, 1); 
Any ideas what I'm doing wrong?
Apr 9, 2013 at 5:02 PM
Hm, well I just discovered that if I move the starting row down from 1, to 2: "ws.Cells[2, 2, currentRow, 2]" then it goes back to working with the insert...but it does leave the first column blank without the formula. So that's no good. Not sure how to get around that.