//开启Excel APP
Excel.Application xlApp = new Excel.Application();
//获取程序下bin—>debug下的文件夹的两种方法(System.IO.Directory.GetCurrentDirectory();System.AppDomain.CurrentDomain.BaseDirectory )
//读取模板
sTemplateFilePath = System.IO.Directory.GetCurrentDirectory() + "\\ExcelTempFile\\直通率.xlsx";
//开启模板档案
Excel.Workbook xlBook = xlApp.Workbooks.Open(sTemplateFilePath, 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);
//取得模板的sheets页面用于写入数据
Excel.Worksheet RtySheet= (Excel.Worksheet)xlBook.Worksheets["SheetTemp1"];
// Excel.Range oRange1 =RtySheet.get_Range() 用于取得excel中的区域
对excel列是用第一行的字母加第一列的序号来取得位置的;
具体想获取操作的代码可用宏录制;