已经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

 

评分:0

我来说两句

日历

« 2024-05-12  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 18079
  • 日志数: 4
  • 建立时间: 2012-12-20
  • 更新时间: 2013-01-14

RSS订阅

Open Toolbar