문제

I am working on some Word automation code in C#. I have Word 2007 installed on my own machine (Version 12.0.0.0 of Microsoft.Office.Interop.Word.dll) but I would like to support Word 2003 as a minimum (Version 11.0.0.0 of Microsoft.Office.Interop.Word.dll?).

Without having Word 2003 available to me, is there any way that I can target it so that my code is backward compatible? I can't install the PIA redistributable package without having Word 2003 installed.

도움이 되었습니까?

해결책 3

My solution was to grab a copy of Microsoft.Office.Interop.Word.dll and office.dll from a computer with Word 2003 installed. These are only used to build against so that my code works on systems that have Word 2003. Not ideal, but it works.

다른 팁

I'm fairly sure making a bindingRedirect in app.config will do the trick.

http://msdn.microsoft.com/en-us/library/eftw1fys.aspx

If you don’t mind losing intellisense and you are using .Net 4 you can get rid of the PIA altogether by using dynamic.

Code Example:

var type = Type.GetTypeFromProgID("Word.Application");
dynamic word = Activator.CreateInstance(type);
word.visible = true;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top