Word Automation Backwards Compatibility With Word 2003

1k views Asked by At

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

There are 3 answers

0
Alan Spark On BEST ANSWER

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.

1
Ron Sijm On

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

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

1
Tom Brothers On

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;