简体   繁体   English

Microsoft.Office.Interop.Excel COM Dll的用法

[英]Microsoft.Office.Interop.Excel COM Dll usage

To use "Microsoft.Office.Interop.Excel" COM dll in the .net project, which is the better approach. 要在.net项目中使用“ Microsoft.Office.Interop.Excel” COM dll,这是更好的方法。

  1. Add dll reference from list of COM libraries to the project? 将DLL参考从COM库列表添加到项目中?
  2. Copy the dll to bin/Release folder and then reference? 将dll复制到bin / Release文件夹,然后引用?
  1. Approach is fine(dll will copy to your bin while build). 方法很好(在构建时dll将复制到您的bin中)。
  2. Don't Keep the DLL in Bin\\Release, Instead keep it in custom folder (lib) and refer. 不要将DLL保留在Bin \\ Release中,而是将其保留在自定义文件夹(lib)中并进行引用。

Adding to what @Jaya wrote, if you are targeting .NET 4.0 or later you can also select the referenced dll and set "Embed Interop Types" to true. 除了@Jaya编写的内容外,如果您的目标是.NET 4.0或更高版本,则还可以选择引用的dll并将“嵌入互操作类型”设置为true。 This option (called NOPIA) will eliminate the need to deploy the Excel interop dll with your program. 此选项(称为NOPIA)将不需要在程序中部署Excel interop dll。

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

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