C# dataGridView导出Excel 中的问题?

public static void ExportDataGridTableToExcel(DataGridView grid, string ExcelTitle)
{
Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
Microsoft.Office.Interop.Excel.Range range = xlApp.get_Range(xlApp.Cells[1, 1], xlApp.Cells[1, grid.Columns.Count]);
........................................
}

其中这个方法里的这段代码什么意思啊?
Microsoft.Office.Interop.Excel.Range range = xlApp.get_Range(xlApp.Cells[1, 1], xlApp.Cells[1, grid.Columns.Count]);
特别是()中的两个Cells[ ] 怎么解释啊? xlApp.Cells[1, 1], xlApp.Cells[1, grid.Columns.Count]

excel.Visible = true; 改成false 导出数据的时候改成不可见. 500条不是很多..你可以试试..你说的这种情况没遇见过...
希望能解决您的问题。
温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2016-05-28
Range 是范围的意思。

第一个Cells[ ]
是起始单元格: 第一行第一列
第二个Cells[ ]

是结束单元格: 第一行第n列本回答被提问者采纳
相似回答