Hello Aram I do not know if you are aware of this but the Word file you are dealing with is actually zipped xml. It should be possible to use a utility such as WinRAR or PKUnzip to open the file and reveal it's underlying structure. Now, I am guessing that if you do this and then take a dig around, that somewhere in those files will be the binary 'source' for the embedded document and it is this that you will need to update. Speaking off of the top of my head, you may be able to use a combination of POI and core java code to accomplish the task. At the moment, I am imagining something where you use POI to recover the Excel document and update it. the, stream out to a file on your local drive. Next, you use the core java api to unzip the document, open a stream onto the Excel document you created earlier and then stream it's contents into the appropriate location within the Word zip file. Finally, the core java api can be used to create a new zipped, and updated, file. If I have the chance, I will play around with something like this in the next couple of days - the weather is making it impossible for us to work outside currently. Should it prove to be sucessful, I will post the code here.
Another course of action would be to look at the xmlbeans code that underpins XWPF. I suspect that somewhere there will ne in place the hooks required to allow us to work with embedded files in the manner you require - for example creating something like an setEmbeddedDocument() method. If you can download a copy of the project's source and if you have the time, it may ne worthwhile starting to dig into the inner workings to try and find out if this is possible. Yours Mark B PS Thinking about it further, it might - and that is might - be possible to unzip the Word document and open an HSSFWorkbook on the embedded object directly, update it, stream it to disc and then re-zip the Word document. Will take a look at this also. -- View this message in context: http://apache-poi.1045710.n5.nabble.com/Updating-an-embedded-Excel-file-inside-Word-tp3293554p3294398.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
