How to add an image at a specific location in MSWord Using C#?

using word = Microsoft.Office.Interop.Word;

How do I add an image at a specific co-ordinate of the Word documents.

I have been searching for a while, but unsuccessful in finding a solution for this problem.

EDIT Currently using :

    oDoc.Application.Selection.InlineShapes.AddPicture(@"C:\Users\MHD\Desktop\retouche.bmp");
    oDoc.Application.Selection.MoveDown(word.WdUnits.wdScreen, 2);

Problem:

enter image description here

What is needed:

enter image description here

So the image should be located at the bottom right corner of the last page in the document.

Upvotes: 0

Views: 3453

Answers (2)

Xiaoy312
Xiaoy312

Reputation: 14487

Instead of inserting a inline shape which is positioned within the text. You may want to insert as a normal shape, which can be positioned anywhere above the text:

oDoc.Application.ActiveDocument.Shapes.AddPicture(
    @"C:\Users\MHD\Desktop\retouche.bmp",
    null, null,
    left, top, width, height)

Upvotes: 2

tgondar
tgondar

Reputation: 184

one way to do that is:

  • open your word document > add a bookmark named: "PicHere"

  • and then check this link

Upvotes: 1

Related Questions