日期:2014-05-20  浏览次数:20806 次

C#怎么写入EXCEL文件
把DATSET写入EXCEL2003中, 要求规定写入时给出左上角和右下角的坐标一次写入,请问可以做到吗,如果不能也绝对不能一个格一个格的写,按行写也可以,请高手指教.最好有点代码.

------解决方案--------------------
ExcelApplication excel = new ExcelApplication();
excel.Visible = true;

excel.Workbooks.Add(Missing.Value);
Worksheet worksheet = (Worksheet) excel.ActiveSheet;

Range r = worksheet.get_Range( "C6 ", Missing.Value);
r.Value2 = "Hello ";
r.Interior.ColorIndex = 6;

worksheet.SaveAs(@ "c:\ExcelExample.xls ",
Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value);
excel.Quit();