Word: Add picture (VSTO2005)  
Author Message
ClaudiaHelpOnVSTO





PostPosted: Visual Studio Tools for Office, Word: Add picture (VSTO2005) Top

Hi,

I would like to display a picture in the Word document which I download from a remote server. So fare, there is no problem. I can just download the picture, store it on the client machine and display it with the following command:

range.InlineShapes.AddPicture("C:/picture.gif",ref missing, ref saveWithDocument, ref missing);

Question: Is it possible to add a picture to the document without having to save the downloaded picture

I tried this… but it didn’t work of course:

range.InlineShapes.AddPicture("http://www.mysite.com/picture.gif",ref missing, ref saveWithDocument, ref missing);

Thanks,
Claudia



Visual Studio Tools for Office9  
 
 
Cindy Meister





PostPosted: Visual Studio Tools for Office, Word: Add picture (VSTO2005) Top

Hi Claudia

The alternate approach is to stream the picture information to the Clipboard, then use the Paste method in Word to insert it.

Another possibility, since this is Word 2003 I assume, would be to stream the picture into WordProcessingML format, then use the InsertXML method to put that into the document. I've never done this before, however, and people do report problems getting the picture in a format acceptable to Word. Theoretically, however, it should work...