poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pablo D. Salgado" <pdsalg...@gmail.com>
Subject How to insert footer to doc file
Date Wed, 20 Jun 2012 13:12:35 GMT

I'm Pablo, this is my first question here. I need to add a text to a footer
section on an existing .doc file. (I have no experience on POI with doc
I tried the following code:

POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("sample.doc"));
HWPFDocument doc = new HWPFDocument(fs);
WordExtractor we = new WordExtractor(doc);
HeaderStories headerStories = new HeaderStories(doc);
Range rangeO = headerStories.getOddFooterSubrange();
rangeO.insertAfter("Footer text from POI");
FileOutputStream newdoc = new FileOutputStream("output.doc");

But the text "Footer text from POI" is not inserted on the footer section,
it is inserted on the end of the document body. I'm using POI 3.8 and I'm
opening the output.doc using Office 2010 on Windows machine.

Thank you in advance,



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message