Rohit Gupta
Rohit Gupta

Reputation: 4191

How can I insert an image in to Microsoft Word programmatically?

We need to insert a signature image into a Word template document. We are doing the mail-merging, etc. fine. But how do we insert an image programmatically? The signature image is not always the same.

We are using Delphi. But I can translate a C solution (if it does not use C libraries).

I also need to know how to position the image.

Upvotes: 0

Views: 2580

Answers (1)

RepeatUntil
RepeatUntil

Reputation: 2320

var
Word, Doc: Variant;
begin
  Word := CreateOleObject('Word.Application');
  Doc := Word.Documents.Open('C:\test\word.docx');
  Word.ActiveDocument.InlineShapes.AddPicture('C:\test\sign.bmp');
  Doc.Save;
  Word.Quit;
end;

Upvotes: 4

Related Questions