On 12/7/2010 7:56 PM, Nick Burch wrote:
On Tue, 7 Dec 2010, Aram Mirzadeh wrote:
On 12/7/2010 12:47 AM, Nick Burch wrote:
On Sun, 5 Dec 2010, Aram Mirzadeh wrote:
I'm trying to update the values for the excel chart. I can read the docx, get the embeded object, and read and modify the cells that I need. My question is how do you save the embedded excel file?

You'll get the ooxml document part for the embedded file, from which you get the input stream to read it. You should be able to get an output
stream onto the same part too, to save the changed version.

I was with you until the "output stream onto the same part". If it's an inputstream for the file, how do you write it back out as the same part?

The PackagePart is read/write. You can get both an inputstream and an outputstream from it http://poi.apache.org/apidocs/org/apache/poi/openxml4j/opc/PackagePart.html

Let me make sure I'm on the right path here, because this isn't sticking in my head yet.

1. Open the docx
2. Get all embedded part as pPart
3. Use pPart.getPartName().getName() to get the name of the embedded file.
4. Open the pPart.
5. Find and modify the cells that I want.
6. Re-Open the docx as a ZipInputStream
7. find the embedded file inside of the zip via step #3
8. save the pPart as a ZipEntry file?
9. save the Zip from #5?

// TODO ... also need to find the original image of the chart and delete that out of the docx so that it's re-generated.

That seems like it's very awkward. Any examples or piece of code that you can point me to that does this?


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
For additional commands, e-mail: user-h...@poi.apache.org

Reply via email to