Insert Picture into a Document
Contents
[
Hide
]
See more details in the Working with Images documentation section.
The DocumentBuilder provides several overloads of the InsertImage method that allow you to insert an inline or floating image. If the image is an EMF or WMF metafile, it will be inserted into the document in metafile format. All other images will be saved in PNG format.
The following code example shows how to insert an image info a document:
Document doc = new Document("../../data/document.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertImage("../../data/HumpbackWhale.jpg");
doc.Save("insertedImage.docx");
See also:
- GitHub for running code