The approach I tried was this;

Open the Word doucment by instntaiting the XWPFDocument class.
Get the list of embedded documents.
Iteratate through the list to find the embedded workbook.
>From the PackagePart, recover an InputStream and use this to create an
HSSFWorkbook object that allowed me to manipulate the embedded workbook.
>From that same PackagePart, recover an OutputStream.
Pass the OutputStream to the write method of the HSSFWorkbook.
Finally, call the write method on the XWPFDocument.

The resulting Word document was valid - in so far as Word would open it
without complaint - but I found that the embedded workbook was now
completely empty. All of the workbooks contents had been erased and I am
guessing this was caused by the streaming process but cannot be at all
certain as I have not investigated further.

To date, the only way I have found to successfully update the embedded
object is to use a mix of care java code to unzip and then re-zip the docx
file and POI to manipulate the embedded workbook. This works but it still
leaves the problem of updating the .emf to reflect the changes made to the
embedded object.

Yours

Mark B
-- 
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Updating-an-embedded-Excel-file-inside-Word-tp3293554p3300507.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]

Reply via email to