C#-适用于Excel 2007和2010的Excel插件

我正在编写一个Excel插件,该插件在2007年和2010年都可以使用.当我使用Visual Studio创建新项目时,我需要确定所需的版本.我之前选择的是2007,但由于安装了2010,所以无法调试它.我收到一个错误:

You cannot debug or run this project,
because the required version of the
Microsft Office application is not
installed.

据我了解,如果我以2007年为目标,那么我应该可以同时在2007年和2010年运行它.这是正确的吗?如果是这样,我可以使用2010进行调试吗?

最佳答案

A shared Add-in is made from a Visual Studio project creating a Com Add-In implementing the IDTExtensibility2 interface. This grants you access to the Excel model (workbooks, worksheets, Range, …).
This kind of project is still today what looks the most like a C# XLA. They are often used for formal commercial development deployed to external clients. While they are more difficult to make and maintain, they do give you deeper control over the Add-in and can be made somewhat version-agnostic (that is, you can use your own IA instead of a specific Office PIA library, and/or can do more in late binding to handle multiple Office versions with lower risks of compatibility problems).

这里:http://metasharp.net/index.php?title=Csharp_and_Excel_Interoperability

转载注明原文:C#-适用于Excel 2007和2010的Excel插件 - 代码日志