1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
//1. Creating a new Excel application
xlApp = new Excel.Application();
xlApp.Visible = false;
//2. Getting the workbooks collection
xlWorkbook = xlApp.Workbooks.Open(this.name,
Type.Missing,Type.Missing,Type.Missing,Type.Missing,
Type.Missing,Type.Missing,Type.Missing,Type.Missing,
Type.Missing,Type.Missing,Type.Missing,Type.Missing,
Type.Missing,Type.Missing);
//3. Getting the sheet collection
Excel.Sheets xlSheets = xlWorkbook.Sheets;
//4. Getting the first sheet to write
xlWorksheet = (Excel._Worksheet)xlSheets[1]; |
Partager