Could you please explain your motivation for wanting to bind it to a URL?
Is it just a matter of convenience, so you don't have to programmatically include the image in your XML?
Or is it because you want to keep the file size down? Or is there a possibility that the image at the URL will be altered, and you want that change to automatically flow through into a bunch of documents?
I ask because this affects the design of the feature:-
One possibility would be to use a picture content control (which has the benefit that it looks like a picture control to the person designing the document in Word, and allows the user to set the image size), but then, in the pre-processing step, remove the control entirely, and replace it with a WordML image pointing to the external image (ie a linked image: this approach would give you a real URL based image).
Another possibility would be to use a picture content control (as above), but then, in the pre-processing step, fetch the external image, and inject it into the element in your custom xml which would ordinarily contain the image data. Word would then just handle this as an ordinary a data-bound image (ie an embedded image).
Or docx4j could provide both, with a switch in the tag telling it whether to link or embed.
jason wrote:One way might be to use a picture content control, but have a tag od:externalImage. The problem with this is that Word might not like to open such a docx (or it might just show an image with a X)
Turns out Word seems to have 4 different cases for the content of the element which is bound to a picture:
1. valid image data (normal case):display it
2. element is empty: display an empty picture control
3. element contains a url: ignore it; display whatever image is already pointed to in the sdt content (rel)
4. other string: display the red X / image can't be displayed text.