poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MSB <markbrd...@tiscali.co.uk>
Subject Re: Need help in updating footer of Word Document
Date Sun, 16 May 2010 14:42:08 GMT

Quick update.

As it stands, HWPF will not allow you to add a new footer or header into a
document nor modify the existing one(s). The HearderStories class is the one
you should use to gain access to a documents headers and footers and it does
include support for recovering the contents of the same. The javadoc for the
class contains this sentence though;

"WARNING - you shouldn't change the headers or footers, as offsets are not
yet updated!"

If you absolutely have to modify the documents footers and you must process
the older binary file format then you do have options. The most obvious
would be to use OLE to control an instance of Word itself but this technique
will only work if you are running on Windows and it is quite slow. The other
option would be to use OpenOffice and control an instance of that
application via it's UNO interface. Whilst this option would not limit the
platform you could run the code on, it is still quite slow in execution and
there is a fairly steep learning curve to traverse if you want to use UNO.
That interface was designed to support many different programming languages
and so it is not quite as simple as creating an object and calling it's
methods sadly.

Will press on now to look at XWPF.


Mark B

madhusudan.reddy wrote:
> Hi,
> We are using ApachePOI for creating word documents dynamically using java
> in our application. We are wondering if we have a better way to handle the
> header and footers in the word document dynamically.
> Need information or pointers to implement any of hte following things:
> 1) Addition of new footer/header dynamically in the word document.
> 2) Updating an existing footer/header dynamically in the word document.
> Any pointers would be very helpful.
> Thanks & Regards,
> Madhusudan Reddy
> JAVA | HDC | Accenture
> M. No: 9966601155
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information.  If you have
> received it in error, please notify the sender immediately and delete the
> original.  Any other use of the email by you is prohibited.

View this message in context: http://old.nabble.com/Need-help-in-updating-footer-of-Word-Document-tp28566396p28575089.html
Sent from the POI - User mailing list archive at Nabble.com.

To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org

View raw message