Hello,
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
files)
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");
doc.write(newdoc);
newdoc.close();
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,
Regards,
Pablo
|