To insert an image into a section of your document, use one of the following methods. Each method inserts an image at the beginning or end of an Element. An Element object represents an editable region in a document, such as a section or paragraph. The document itself is an Element.
Insert an image specified by file name at the beginning of the element.
InlineImage Element.InsertImageBefore(String fileName)
Insert an image specified by file name at the end of the element.
InlineImage Element.InsertImageAfter(String fileName)
Insert an image contained in the specified stream at the beginning of the element.
InlineImage Element.InsertImageBefore(System.IO.Stream stream)
Inserts the image contained in the specified stream at the end of the element.
InlineImage Element.InsertImageAfter(System.IO.Stream stream)
Before adding an image to your file, you must create a content region in which to insert the image. Each editable region in a Word file is represented by an Element object, or an object that extends Element, such as a Document
object.WordApplication wwapp = new WordApplication(); Document doc = wwapp.Create();
To insert an image, use one of the methods listed at the beginning of this section, for example:
InlineImage img = doc.InsertImageAfter("C:\\sample.jpg");
An inserted image is returned as an InlineImage object. The InlineImage class extends Element.