Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Microsoft Office 2007 on a Server Core Machine

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?

like image 854
Erick Sgarbi Avatar asked Sep 23 '10 06:09

Erick Sgarbi


3 Answers

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.

like image 157
Marc Gravell Avatar answered Sep 28 '22 07:09

Marc Gravell


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

like image 31
Oleg Avatar answered Sep 28 '22 06:09

Oleg


Yes, just use a silent install to get Office 2007 on your Server Core box - refer to TechNet's Office Resource Kit for deployment options. A couple of notes:

  1. The only Office components documented that are not supported directly for Server Core installations are Project Server and SharePoint Server. They won't even install.
  2. You cannot invoke any Word command that requires the client app to .Visible = True. It will result in failure.
  3. Using PowerShell to automate Word is probably the easiest way work with Server Core and Office. With some COM features, you may need to create a .NET wrapper instead of calling from PS directly (most notatably WordBasic calls).
  4. It's all been said before about not doing on Office Automation on the server - but that's not the advice you need. So, make sure you read this: Considerations for server-side Automation of Office
like image 45
Todd Main Avatar answered Sep 28 '22 07:09

Todd Main