.net生成EXCEL
在网上找到的一份.net中EXCEL的生成....
当作是映琳的新开始吧...
1Excel.Application _excelApp = new Excel.Application();
2Excel.Workbook _excelWorkbook = _excelApp.Workbooks.Add(Missing.Value);
3Excel.Worksheet _excelSheet = (Excel.Worksheet)_excelWorkbook.ActiveSheet;
4string[,] sTbArray = new string[100, 5];
5sTbArray[0, 0] = "what?";
6sTbArray[0, 1] = "what????";
7_excelSheet.get_Range(_excelSheet.Cells[1, 1],
8 _excelSheet.Cells[100, 5]).Value2 = (object)sTbArray;
9_excelApp.DisplayAlerts = false;
10_excelWorkbook.SaveAs("c:\\1.xls"
11 , Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value,
12 Missing.Value, Missing.Value, Missing.Value, Missing.Value);
13_excelApp.Quit();
2Excel.Workbook _excelWorkbook = _excelApp.Workbooks.Add(Missing.Value);
3Excel.Worksheet _excelSheet = (Excel.Worksheet)_excelWorkbook.ActiveSheet;
4string[,] sTbArray = new string[100, 5];
5sTbArray[0, 0] = "what?";
6sTbArray[0, 1] = "what????";
7_excelSheet.get_Range(_excelSheet.Cells[1, 1],
8 _excelSheet.Cells[100, 5]).Value2 = (object)sTbArray;
9_excelApp.DisplayAlerts = false;
10_excelWorkbook.SaveAs("c:\\1.xls"
11 , Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value,
12 Missing.Value, Missing.Value, Missing.Value, Missing.Value);
13_excelApp.Quit();