简体   繁体   English

在 Visual Studio 2013 中使用 winword 或 excel 库

[英]Using winword or excel library in Visual studio 2013

I need to programmatically access word and excel files in my dotNet 4.5 Code.我需要在我的 dotNet 4.5 代码中以编程方式访问 word 和 excel 文件。 I am using Visual Studio 2013. I have added a reference to the DLL Microsoft Office 14.0 DLL and used following line of code:我使用的是 Visual Studio 2013。我添加了对 DLL Microsoft Office 14.0 DLL的引用,并使用了以下代码行:

using Word = Microsoft.Office.Interop.Word;

However I get following error when trying to run the application:但是,在尝试运行应用程序时出现以下错误:

The type or namespace name 'Interop' does not exist in the namespace 'Microsoft.Office'命名空间“Microsoft.Office”中不存在类型或命名空间名称“Interop”

You need to add Interop of MSword into your project.您需要将 MSword 的 Interop 添加到您的项目中。 Add reference->assemblies->Extensions find for the interop you want to add and add it. Add reference->assemblies->Extensions find 要添加的互操作并添加它。

Here is a little explanation about interop dll. 这里是关于互操作 dll 的一些解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM