Question

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.

Was it helpful?

Solution 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.

OTHER TIPS

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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top