程序中使用Excel对象 如何添加引用
如题
------解决方案--------------------using Microsoft.Office.Interop.Excel;
在COM组件里,自己添加
看这两个帖子:http://topic.csdn.net/t/20041017/17/3464085.html
http://topic.csdn.net/u/20070313/20/742a175c-bb9f-43a0-bd5b-f1675e66b868.html
------解决方案--------------------using Excel = Microsoft.Office.Interop.Excel; //调用Com Microsoft Excel 11.0 object Library
例子:
Excel.Application excelApp = new Excel.Application();
Excel.Workbook excelWork = excelApp.Workbooks.Open(Server.MapPath("") + "\\test.xls",
System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing);
int num = excelWork.Sheets.Count;
excelApp.Quit();