views:

124

answers:

3

I have a windows service (currently running under Windows 2003 Server) that needs to interact with a few word documents using automation. This Service needs to move to a new server.

Is it possible to install and invoke word documents in a Windows 2008 R2 Server Core Machine?

+2  A: 

Regular Word automation is not supported when running as a service (including things like ASP.NET). It is a desktop client application with an API to automate that application, not an API to the Word subsystem.

You might try looking at Word Automation Services, but note that this is a SharePoint Server 2010 component.

I would strongly recommend looking at alternatives, such as the various tools (some free, some not) for writing Word documents, or other file formats.

It seems moot, but I also doubt that Word will work on server-core. It is heavily stripped down for scoped server usage, and will be missing many things that a desktop client application will want to use.

Marc Gravell
+3  A: 

I would you recommend to use Open XML SDK 2.0 for Microsoft Office. On XML in Office Developer Portal, "How to: Word Processing with respect of Open XML SDK 2.0" and http://openxmldeveloper.org/ you will find a lot of example how to use Open XML SDK 2.0.

Open XML SDK 2.0 is technology special for the usage on the server. You don't need to install Office on the server at all and will be read, modify etc. office documents on the server. At the beginning the switching from Word automation to Open XML SDK seems difficult, but I do recommend you invest a little time to study the technique. In a short time you will be lucky to use it on the server. Some interesting code examples and utilities you will also find of the codeplex.com (just search for "Open XML"). For example look at Demo 04 from http://openxmldemos.codeplex.com/.

Oleg
A: 

Pay attention to Marcs warning about it not being supported (and the alternatives provided by Oleg).

Since office automation (at least the way it sounds like you are using it) basically invokes the program (you see it in the task mgr) but with visibility set to false it will NOT work on Server Core. You would have to be able to install and run office (which you can't on core).

http://technet.microsoft.com/en-us/library/dd184076.aspx "You also can't use it for running Microsoft Office System applications or Microsoft Office SharePoint Server. And you can't (or at least shouldn't) use it to run custom applications you've developed in-house".

ktharsis
Open XML SDK 2.0 is not invokes any Office program. It works win DOCX documents like with XML files, but with respect of simplified Open XML SDK 2.0 API. So it should work and be supported on Windows 2008 R2 Server Core.
Oleg

related questions