What is the difference between Microsoft.Office.Interop.* version 12 and 14?

三世轮回 提交于 2019-12-23 09:09:17

问题


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.

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 crashed while closing the document.

I switched the reference to version 12, and left my code exactly as it was and tried it again. Everything worked fine.

I have since written the rest of my code using version 12 and haven't had any problems.

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?


回答1:


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.



来源:https://stackoverflow.com/questions/7749310/what-is-the-difference-between-microsoft-office-interop-version-12-and-14

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!