在网上找到的一份.net中EXCEL的生成....
当作是映琳的新开始吧...
1
Excel.Application _excelApp
=
new
Excel.Application();
2 Excel.Workbook _excelWorkbook = _excelApp.Workbooks.Add(Missing.Value);
3 Excel.Worksheet _excelSheet = (Excel.Worksheet)_excelWorkbook.ActiveSheet;
4 string [,] sTbArray = new string [ 100 , 5 ];
5 sTbArray[ 0 , 0 ] = " what? " ;
6 sTbArray[ 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();
2 Excel.Workbook _excelWorkbook = _excelApp.Workbooks.Add(Missing.Value);
3 Excel.Worksheet _excelSheet = (Excel.Worksheet)_excelWorkbook.ActiveSheet;
4 string [,] sTbArray = new string [ 100 , 5 ];
5 sTbArray[ 0 , 0 ] = " what? " ;
6 sTbArray[ 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();