I'm trying to insert an image into a document using a FieldRef as the locator.
So far I've been able to find the field in question using ComplexFieldLocator and have successfully inserted an image at the end of the document by simply adding to the MainDocumentPart but I can't marry the two together.
The FieldRef object I'm able to locate does not seem to have a reference to the main document part. The result of calling getParent() is a P but it is not the same P instance as when I look at the P instance from getMainDocumentPart().getContent().
So any attempt to add a Drawing or Run to the P associated with the FieldRef is not inserting the image into the document - I assume because it's a clone or something and thus doesn't affect the MainDocumentPart.
Is there a way to traverse from a FieldRef to the MainDocumentPart so that I can insert an image at my desired location?