Created attachment 26916 [details] Test document When I'm trying to write a Word document it does not preserve an embedded entries. Attached test document. It's a Word document with another Word document embedded. Here is a code to reproduce the issue: String testdoc = "881-test-embedded.doc"; String testdocout = "out.doc"; POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(new File(testdoc))); HWPFDocument doc = new HWPFDocument(fs); FileOutputStream out = new FileOutputStream(new File(testdocout)); doc.write(out); out.close(); The resulting file "out.doc" does not contain embedded document. Is this a bug or expected behavior?
Looking at the HWPF write code, I can see that there's nothing there to copy the embedded documents over Short term, the fix would be to do something similar to in HSSF, where we copy the extra entries over if a flag is set Longer term, if we switch it from POIFSFileSystem to NPOIFSFileSystem then we can just overwrite the word streams with the new data, and keep all the other ones, which'd probably be a cleaner fix
As a workaround for now, you could manually copy the ObjectPool over. A patch to do this properly (along with a unit test) would be very well received!
Shall be fixed already, please check
No update for a long time, therefore I am closing this, please reopen with more information if this is still a problem for you.