已经using Microsoft.Office.Interop.Excel了,但在代码里还不能直接使用Excel
上一篇 /
下一篇 2012-12-20 16:56:56
今天学习用C#处理Excel文件的时候,已经在Project—>Add Reference里面添加了Microsoft Excel 12.0 Object Library和Microsoft Office 12.0 Object Library等库了,在文件中也加了using Microsoft.Office.Interop.Excel;
using Microsoft.Office.Core;
但是在代码里,却不能正常地使用Excel,需要在代码里每个用到Excel对象的地方都标明Microsoft.Office.Interop.Excel才能使用,否则报错:
“The type or namespace name 'Excel' could not be found (are you missing a using directive or an assembly reference?)”
后来把
using Microsoft.Office.Interop.Excel;
改成
using Excel = Microsoft.Office.Interop.Excel;
就正常了
收藏
举报
TAG:
Excel
excel
EXCEL