是什么Microsoft.Office.Interop之间的差。*版本12和14? [英] What is the difference between Microsoft.Office.Interop.* version 12 and 14?
问题描述
我已经安装了Visual Studio 2010和Office 2007。当我进入添加引用,然后搜索办公室互操作我可以看到,每个指向与12版和14出现两次
I have installed Visual Studio 2010 and Office 2007. When I go to "Add Reference" and search for "Office Interop" I can see that each of the references appear twice with versions 12 and 14.
我最初尝试的Microsoft.Office.Interop.Word
14版,并做了一个快速测试。初始化应用程序,打开文档,关闭文档,退出应用程序,并释放COM对象。我的测试是一个简单的WinForms项目在C#4.0。
I initially tried version 14 of Microsoft.Office.Interop.Word
and did a quick test. Initialise the Application, open a Document, close the Document, quit the Application, and release the COM object. My test was a simple WinForms program in C# 4.0.
WINWORD.EXE同时关闭文档坠毁。
WINWORD.EXE crashed while closing the document.
我切换参考12版,并留下我的代码完全一样,并再次尝试。一切正常。
I switched the reference to version 12, and left my code exactly as it was and tried it again. Everything worked fine.
我后来写的使用版本12我的代码的其余部分并没有任何问题。
I have since written the rest of my code using version 12 and haven't had any problems.
所以现在我很好奇:有在 Microsoft.Office.Interop公开暴露成员之间的一些小分歧*
12版和14,但主要有很多的重叠。
So now I'm curious: There are some small differences between the publicly exposed members in Microsoft.Office.Interop.*
in versions 12 and 14, but largely there is a lot of overlap.
有什么实际的区别?为什么我的简单测试失败,即使我有办公室的一个相对较新的版本? ,是有规则的,拇指哪个版本应该在开始互操作项目时,开发商选择?
What is the actual difference? Why did my simple test fail even though I have a relatively new version of Office? and is there a rule-of-thumb as to which version should the developer choose when starting an interop project?
推荐答案
12版是互操作的Office 2007,而14是Office 2010。据我所知,除非你真的需要的14版的一些新功能,您可以使用互操作库的较低版本,它会正常工作适用于所有Office新版本。
Version 12 is interop for Office 2007, while 14 is for Office 2010. AFAIK, unless you really need some new features of 14th version, you can use a lower version of interop library and it will work fine for all newer versions of Office.
这篇关于是什么Microsoft.Office.Interop之间的差。*版本12和14?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!