Read word document in ASP.NET and replace text (Office 2003/2007)

asp.netintegrationms-officems-wordreplace

I'm using VS 2005, asp.net 2.0.

I need to read a word document (.doc) in asp.net, make some replaces and then generate another word document.

So far OK. I've done it in a machine that have the Office 2003 installed, so in VS 2005 I've added a reference to the "Microsoft Word 11.0 Object Library". Everything worked perfectly. Code to open/save the word document: http://www.dnzone.com/go?1387

Question 1: I need to open the same project in a machine that has Office 2007 installed and make it run. When I do it, it doesn't recognizes the references.. I only have the possibility to add reference to the "Microsoft Word 12.0 Object Library". How can I make it work smoothly in both machines with the less effort possible? Is there a way to do so?

Question 2: Will this application work fine when I deploy it to a web server? Do I have to register some dll or component in the server or do anything else in order to this office integration to work?

Best Answer

You should never use the Word API from server code. It is not supported and will generally not work reliably.