C#/Excel interop - performance tips?
Thanks. It looks OK when reading from Value2, is there a way to "batch write" as well? It seems that if I assign an array object back to the Value2 object, only the first cell is updated
The following code can read the data successfully, but only the first cell is updated when write back
-------------------------------------------------------------------------------
Excel.Range oRng = (Excel.Range)oWS.get_Range("A1", "B4")
object[,] data = (object[,])oRng.Value2
for(int i=1; i<=data.GetUpperBound(0); i++
for(int j = 1; j <= data.GetUpperBound(1); j++
Console.WriteLine("(" + i + "," + j + ") = " + data[i,j])
data[i,j] = "NEW" + data[i,j]
oRng.Value2 = data;
|