将string数组插入到Excel表单中

我有一个[,]string数组是40行乘40列项目。 我试图把它们写入Excel表格,但是输出在每列的第一行写入相同的单词。 我究竟做错了什么?

public static void writeToFile(this string [,] result) { try { //open instance of excel Microsoft.Office.Interop.Excel.Application app = null; app = new Excel.Application(); app.Workbooks.Add(); Excel._Worksheet sheet = app.ActiveSheet; sheet.Name = "Sheet 1"; int resultCount = result.Length; for (int i = 0; i < 40; i++) { for (int j = 0; j < 40; j++ ) { sheet.Cells[i].Value = result[i,j]; j++; } i++; } 

如果你有一个第一维的行和第二维的列的数组,你可以简单地写:

 sheet.Range[sheet.Cells[1,1], sheet.Cells[40,40]].Value = result;