On 12/8/2010 8:06 PM, Nick Burch wrote:
On Wed, 8 Dec 2010, Aram Mirzadeh wrote:
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.
You might want to do this with relationships rather than enumerating
all the names.
4. Open the pPart.
5. Find and modify the cells that I want.
6. Re-Open the docx as a ZipInputStream
You shouldn't need to do this. Just write back to the part you already
have to hand, then write out the overall package when done.
// TODO ... also need to find the original image of the chart and
delete that out of the docx so that it's re-generated.
I think you might be able to spot this using the relationships, but I
might be wrong. I'd suggest you look at the xml of a few sample files
(both of the document stream and the relationships of it) to figure
out what's done
That seems like it's very awkward. Any examples or piece of code
that you can point me to that does this?
Maybe not, but there is some code in Apache Tika that does steps 1-4
for you, in the context of text extraction with embedded attachemnts.
If you do get this working, do please submit an example though!
Well I tried everything I could think of. I cannot seem to figure out
how to write that one section back in. I even tried recreating the zip
file but word thinks that it's corrupted so I'm doing something wrong.
Aram
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]