I have an ms-word document (MS-Office 2003; non-xml). Within this document there is a line associated with the bookmark. Moreover, the word document contains macro words. My goal is to read a document with java, replace the line associated with the bookmark, and save the document back to text format.
My first approach was to use Apache POI HWPF:
HWPFDocument doc = new HWPFDocument(new FileInputStream("Test.doc"));
doc.write(new FileOutputStream("Test_generated.doc"));
The problem with this solution is that the generated file no longer contains a macro (the file size of the source document: 32k; the file size of the generated document is 19k).
Anyone now, if you can save all the original information using POI / HWPF?
source
share