tags:

views:

168

answers:

2

As part of our build process (java build with ant), I want to update a version number somehow in or near a Word document (software guide). "near" meaning I'd accept updating the document properties rather than something in the text itself.

From looking around the internets, it looks like the main option is writing a small C# program that uses Office's COM functionality to do this task. I have a big philosophical problem with this (not the C# part, but making Office and COM part of our build process). Are there any other options out there?

(Yes, .docx is theoretically XML; haven't found anybody updating it that way yet - why not?)

A: 

Version 3.5 of Apache POI (a Java API for accessing Office format files) has support for Office Open XML format documents. It is currently in beta as of writing.

The Aspose.Words class library looks like a non-free option that could also be used to help solve your problem.

Simon Lieschke
OpenOffice isn't going to cut it here - thanks anyways. Aspose would be nice at a MUCH smaller price, maybe.
M1EK
Office Open XML is unrelated to OpenOffice.org XML. They are two similarly named, but separate formats. See http://en.wikipedia.org/wiki/Office_Open_XML and http://en.wikipedia.org/wiki/OpenOffice.org_XML for details.
Simon Lieschke
Accepting this one because I hate to leave this hanging out there, but was really hoping for something other than beta and docx. The other answer requires COM, which I don't want to get involved with (I don't want Word to even be installed on the machine; I'd like to eventually be able to build this on linux; etc).
M1EK
A: 

You could have a look at how Groovy does it using using their Scriptom module which is based on the Jacob library (Java COM Bridge).

Gaël Marziou