当前位置: 代码迷 >> ASP.NET >> 程序中使用Excel对象 怎么添加引用
  详细解决方案

程序中使用Excel对象 怎么添加引用

热度:2253   发布时间:2013-02-25 00:00:00.0
程序中使用Excel对象 如何添加引用
如题

------解决方案--------------------------------------------------------
using Microsoft.Office.Interop.Excel; 


在COM组件里,自己添加


看这两个帖子:http://topic.csdn.net/t/20041017/17/3464085
http://topic.csdn.net/u/20070313/20/742a175c-bb9f-43a0-bd5b-f1675e66b868
------解决方案--------------------------------------------------------
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();
  相关解决方案