Interop.Excel和Tools.Excel之间的区别? [英] Difference between Interop.Excel and Tools.Excel?
问题描述
我目前正在为Microsoft Excel开发一个AddIn,我对某些事情有些困惑:
I'm currently working on an AddIn for Microsoft Excel, and I'm a little confused about something :
Interop.Excel
和 Tools.Excel
吗?例如,在 Interop.Excel.Workbook
和 Tools.Excel.Workbook
之间?或 Interop.Excel.Worksheet
和 Tools.Excel.Worksheet
吗?
What are the differences between Interop.Excel
and Tools.Excel
? For example, between Interop.Excel.Workbook
and Tools.Excel.Workbook
? Or Interop.Excel.Worksheet
and Tools.Excel.Worksheet
?
它们的用途是什么,我该在哪里使用?
What are they used for, where do I use which one ? Is it possible to cast from one to another ?
谢谢!
推荐答案
Microsoft.Office.Tools.Excel是Visual Studio工具针对Office和Excel项目公开的对象集。如果您使用共享加载项模板进行直接Interop,则不应在项目中引用该库。仅在基于VSTO模板创建项目时才有意义。
Microsoft.Office.Tools.Excel is the set of objects exposed by visual studio tools for office, for Excel projects. If you're doing straight Interop, using the Shared Add-in template, then you shouldn't reference this library in your project. It's only relevant if you're creating a project based on a VSTO template.
如果您是从标有Excel的模板创建加载项,则在新建项目对话框的Office文件夹下框,那么您需要保留此参考。例如,当您使用Globals.ThisApplication关键字时,该库就会起作用。此页面将为您提供一些解释,并链接到有关Tools.Excel库的主题: http://msdn2.microsoft.com/zh-cn/library/wss56bz7.aspx
If you created the Add-in from a template labelled for Excel, under the Office folder in the New Project dialog box, then you need to leave this reference. The library comes into play, for example, when you use the Globals.ThisApplication keyword. This page will give you some explanation and links to a topic about the Tools.Excel library: http://msdn2.microsoft.com/en-us/library/wss56bz7.aspx
这篇关于Interop.Excel和Tools.Excel之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!