如何引用 Microsoft.Office.Interop.Excel dll? [英] How to reference Microsoft.Office.Interop.Excel dll?

查看:176
本文介绍了如何引用 Microsoft.Office.Interop.Excel dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 2006 年使用 MS VS 2005 开发了一个处理 Excel 表格的系统.现在,我不能使用与 MS VS 2012 相同的参考.

var app = new Microsoft.Office.Interop.Excel.Application();工作簿 wbs = app.Workbooks;

解决方案

使用 NuGet (VS 2013+):

在任何最新版本的 Visual Studio 中,最简单的方法是使用 NuGet 包管理器.(甚至 VS2013,带有

<小时>

VS 2012:

旧版本的 VS 无法访问 NuGet.

  • 右键单击引用"并选择添加引用".
  • 选择左侧的扩展程序".
  • 查找 Microsoft.Office.Interop.Excel.
    (请注意,您只需在右上角的搜索框中键入excel"即可.)

<小时>

VS 2008/2010:

  • 右键单击引用"并选择添加引用".
  • 选择.NET"标签.
  • 查找 Microsoft.Office.Interop.Excel.

I had developed a system that deals with excel sheets in 2006 using MS VS 2005. Now, I can not use the same reference with MS VS 2012.

var app = new Microsoft.Office.Interop.Excel.Application();
Workbooks wbs = app.Workbooks;

解决方案

Use NuGet (VS 2013+):

The easiest way in any recent version of Visual Studio is to just use the NuGet package manager. (Even VS2013, with the NuGet Package Manager for Visual Studio 2013 extension.)

Right-click on "References" and choose "Manage NuGet Packages...", then just search for Excel.


VS 2012:

Older versions of VS didn't have access to NuGet.

  • Right-click on "References" and select "Add Reference".
  • Select "Extensions" on the left.
  • Look for Microsoft.Office.Interop.Excel.
    (Note that you can just type "excel" into the search box in the upper-right corner.)


VS 2008 / 2010:

  • Right-click on "References" and select "Add Reference".
  • Select the ".NET" tab.
  • Look for Microsoft.Office.Interop.Excel.

这篇关于如何引用 Microsoft.Office.Interop.Excel dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆