How to insert image in a existing word document with c#

13,243

Of course, the Word object model provides the required methods for inserting an image into the document. To add a picture at the cursor location you just need to call the AddPicture method of the InlineShapes collection and pass in the name of the file.

 Application.Selection.InlineShapes.AddPicture(@"C:\SamplePicture.jpg");

See How to: Programmatically Add Pictures and Word Art to Documents for more information.

Also you may consider using the Open XML SDK. Take a look at the following articles in MSDN:

Share:
13,243
Arnab
Author by

Arnab

Professional Tester , Passionate developer and Hobbyist photographer.

Updated on June 04, 2022

Comments

  • Arnab
    Arnab almost 2 years

    I am working with word and c# . taking the snap shot with my code and saving it in a particular folder (ex.C:\Temp). now i want to save the image to an existing word document.any kind of help with short code sample is highly appreciated .
    Will prefer to use Microsoft.Office.Interop.Word;