by using TraversalUtil i can get the logical structure of my docx-File, e.g.:... org.docx4j.wml.P org.docx4j.wml.R org.docx4j.wml.CTObject org.docx4j.vml.CTShape org.docx4j.vml.CTImageData org.docx4j.vml.officedrawing.CTOLEObject...

But how can i get the actual binary data for CTImageData and CTOLEObject. I can get all MetafileWmfPart, MetafileEmfPart and OleObjectBinaryPart with getParts, but then i don't know which Part belongs to which CTxxx and so the the logical structure is lost.Is there a way to get the the Part for a JAXBElement or vice versa? I want to extract ether the OLEObject or the Image, but not both.

I created a sample docx-File using Office and inserted two OLE-Objects using Copy/Paste from Accelrys-Draw. With getParts() i get 2 OleObjectBinaryPart and 2 MetafileEmfPart,but i don't know which Emf belongs to which OleObject. With TraversalUtil i get the hierarchy of JAXC-Elements and know which CTImageData belongs to which CTOLEObject. So now i just need the connection CTImageData->MetafileEmfPart and CTOLEObject->OleObjectBinaryPart. CTImageData has relid=null, and CTOLEObject has no relid, only a shapeid?

CTShape shape = getShape(object);if(shape==null){System.out.println("No Shape in this Object");}else{
CTImageData imageData =(CTImageData)XmlUtils.unwrap(shape.getPathOrFormulasOrHandles().get(0));// You should make this more robustif(imageData==null){System.out.println("No imagedata in this Object");}else{
Part target = documentPart.getRelationshipsPart().getPart(imageData.getId());System.out.println(target.getClass().getName());// expect org.docx4j.openpackaging.parts.WordprocessingML.MetafileEmfPart}}}