I am trying to use C# and Open XML to insert an image from a url into a doc. The image may change so I don’t want to download it, I want it to remain an external reference.
I’ve found several examples like this one that allow me to add a local image:
http://msdn.microsoft.com/en-us/library/bb497430.aspx
How can I adapt that to take a URI? Or is there another approach altogether?
You can add an external image to an word document via a quick parts field.
For a description please see the following answer on superuser.
To realize the described steps programmatically you have to
use an external releationship to include an image from an URL.
Here are the steps to accomplish this:
releationship the same ID you specified in step 3.
The following code just implements the steps described above. The image is added to the
first paragraph in the word document.
In the code above I’ve omitted the code to define the shape type. I advise you to use a
tool like the OpenXML SDK productivity tool
to inspect a word document with an external releationship to an image.