With current (i.e. pre Word 2007) versions of MSWord, there are problems attempting to use WORD automation on an unattended server. The main ones are:

  • WORD is not thread safe. Trying to start more than one instance can crash you. This results in very limited throughput if you are trying to do higher volume
  • WORD can open "pop-up" error dialogues at any time, effectively hanging the app until some form of intervention occurs.

Microsoft strongly recommends that you not implement server based automation. Thats great, except in many cases there is no other way to do what you need to do!

So my question is whether Word 2007 solves these problems, and whether that makes use of WORD 2007 in a server based application an viable option I am specifically looking at a "document rendering" web service. We have a document management database with a few terabytes of documents, much of it in MS Word documents. I need to be able to render a WORD document to PDF to enable it to be displayed on our web portal. It sounds like Words 2007 "Save to PDF" is just what I need. So I am visualizing development of a web service which will accept a request to render a document, retrieve it from the database, use VSTO to load the document and automate the "save as PDF" ,and take the resulting PDF document and return it as the web service response.

IF this approach doesn't work, I am looking at having to purchase some fairly expensive commercial software products that do the same thing, but use multiple workstations and instances of Word (to get around the threading / stability problems)....a kind of complex and expensive solution... (note my go live date is in 2007, so the time frame for Office 2007 would work for me, if the architecture is viable)

Can anyone give me an idea of whether it would be viable to pursue a Word 2007 based solution

Re: Visual Studio Tools for Office Word automation from a Web Service

John R. Durant - MSFT

Word 2007 is also not supported for automation on the server. However, with the new Office Open XML file format, the need should be largely removed. With the new format, you can generate or modify full-fledged Word documents on the server with greater ease than you could with Word 2003. I recommend you get the full background on this by going to the resources on MSDN:





Re: Visual Studio Tools for Office Word automation from a Web Service

Cindy Meister

Just recently it was announced that Save to PDF will not be integrated into Office 2007. It should be available as a d/l to add in. Don't know if that will work in the scenario you visualize.

John mentions XML file formats; Word 2003 has this already. The main difference between now and what will be available when Office 2007 comes out is that a conversion filter will also be available at that time. For Word 2002 and 2003, this can be installed as an "automatic update", providing full capability for opening and writing Word 2007 XML files. For Word 2000 the converter can be installed, but it won't be integrated as fully with the Word application, meaning the conversions may not be as good or as seamless.

If you go the XML route, then you should be able to find (or program) a tool that will convert the Word XML to PDF without needing to automate Word at all. (Note: the same should be possible already with Word 2003 XML, search the Internet for tools.)

Re: Visual Studio Tools for Office Word automation from a Web Service


I am working now on a project to automate Word report generation from a web service using VSTO and .NET remoting. There doesn't seem to be any reason why you can't automate this right now using VSTO 2005 since you can generate word docs on the server without having to start an instance of word or even having office installed.

Though I'm still finalizing the proof of concept for this, what I'm doing is using a web service to invoke a remote VSTO object, passing in some report criteria, and then having the server hosting my VSTO project generate my word docs. These docs are regular, backward-compatible word doc files populated with data from SQL on the fly. HTH


Re: Visual Studio Tools for Office Word automation from a Web Service


Brain, Your project seems interesting.

I am working on a project where we also need to automate word report generation on the Server.

However I do not know how having the word documents as VSTO objects helps Also I do not know how you do NOT need to have word installed on the Server We were initially looking at having Word Projects (VSTO Approach) but since we did not want each word doc to be compiled in a dll , we went the Word Interop approach. We have about 330 word templates with bookmarks. Since Installation of word on server is not recommended , we are know looking at PDF solution. However I found that even Adobe Acrobat 7.0 Professional and using Acrobat SDK is not licensed and recommended for server if we go with PDF Templates and xml data.

However I am interested in finding out how with using Word 2003 Word documents templates with bookmarks ( to hold data) and using Interop based solution can we go with Server based solution using xml and without installing word on server I can get the document data in xml format. Basically I am interested what is needed for your soluton that you mention to work.

Our templates currently in Word 2003 with bookmarks.

Requirements :

Merge Word 2003 Templates with bookmarks with Data from xml

Print Word 2003 Document from Server.

Save as PDF also ( currently I have GhostScript API to do this ....Word to PostScript file and PS to PDF using GhostScript API )

Any help would be greatly appreciated.

Re: Visual Studio Tools for Office Word automation from a Web Service


Hi Brian,

Your mail caught my attention as to how you can invoke a VSTO Object from a WebService. I have been trying to do invoke from a Web Application but not succeded. Could you please throw some suggestion on this



Re: Visual Studio Tools for Office Word automation from a Web Service

Cindy Meister

Hi Jyothi

Search the term "Remoting" in this forum and you should turn up some discussions that will get you started.

Re: Visual Studio Tools for Office Word automation from a Web Service



We're in the poc phase for a word reporting project. We've tried creating the schema/templates in Word 2003 and saving the schema (Generate XSD), Save the same document data as XML by selecting 'Save data only as XML' and using Wml2Xslt.exe provided by M$ (Word ML to XSLT) to generate XSLT and use this XSLT and XML to generate WordML documents.

But, we want to save this WordML to pre Word 2003 (Word 2000) document, Word 2003 .doc files and store it. For this activity we're planning to use VSTO 2005 in server to use the 'save as' feature thru Web Service.

Throw some light on whether the 2nd activity (converting WordML to Word '.doc' file) in server will work as a Web Service.


Re: Visual Studio Tools for Office Word automation from a Web Service


Hi Brian,

I need to generate word documents on the server without VSTO or Office. Can you give me some pointers for this I have already investigated using XSLT and XML to generate Word processing ML documents. However your approach sounds much more interesting !!


Re: Visual Studio Tools for Office Word automation from a Web Service



What I stubbornly discovered during that project is that there is no way to automate word using VSTO, at least not 2005 and I believe it's the same for 2007. The problem with VSTO is that either the Client or Server have to be running Word to start up the Word file. I can tell you that I was able to return a byte array of a Word doc from a web service on the server, but I used a 3rd party product, OfficeWriter to handle the automation.

I heard that MS recently purchased OfficeWriter, so hopefully they will integrate it into VSTO so that we can finally have truly built-in automated file generation.

Good luck,


Re: Visual Studio Tools for Office Word automation from a Web Service


I re-read your post Gaurish and saw you were asking about how to avoid using VSTO in your program. In that case, I would recommend OfficeWriter for a quick and painless approach. They have a decent API that will handle fairly complex documents.