Adding document parts to new document
Posted: Mon Oct 26, 2009 7:53 am
I made the post below a month or two ago and I'm finally getting around to working on the actual problem
viewtopic.php?f=6&t=184
Just to reiterate, I need to add random objects (i.e OLEObjects, images, etc) from one document into a new document. Based on the post above, I just need to 1) get the XML from the original document 2) get the actual object 3) update the relationship ID to the object.
For the post part the steps make sense, but I had a couple followup questions:
1) What's the best way to actually get the object from the document after loading the document using WordprocessingMLPackage.load() and add that object to a new WordprocessingMLPackage that represents the new document.
2) Once I've retrieved the file, I'm assuming I'll need to create a "Part" and add that part using addTargetPart(), but what type of Part would it be? A BinaryPart? I'm assuming I'll need to convert the file object from the original document to an InputStream since that's what a BinaryPart needs.
3) Any code samples that do something the steps listed above?
Any info would be greatly appreciated
Thanks,
Justin
viewtopic.php?f=6&t=184
Just to reiterate, I need to add random objects (i.e OLEObjects, images, etc) from one document into a new document. Based on the post above, I just need to 1) get the XML from the original document 2) get the actual object 3) update the relationship ID to the object.
For the post part the steps make sense, but I had a couple followup questions:
1) What's the best way to actually get the object from the document after loading the document using WordprocessingMLPackage.load() and add that object to a new WordprocessingMLPackage that represents the new document.
2) Once I've retrieved the file, I'm assuming I'll need to create a "Part" and add that part using addTargetPart(), but what type of Part would it be? A BinaryPart? I'm assuming I'll need to convert the file object from the original document to an InputStream since that's what a BinaryPart needs.
3) Any code samples that do something the steps listed above?
Any info would be greatly appreciated
Thanks,
Justin