首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

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

2012-01-28 
程序中使用Excel对象 如何添加引用如题[解决办法]usingMicrosoft.Office.Interop.Excel在COM组件里,自己

程序中使用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();

热点排行