Description
This class is used to represent an inline image in a Word document. The types of images that Word supports are jpg, png, bmp, and gif. Inline images are part of the InlineElement objects of an Element.
C#
public sealed class InlineImage : Element
vb.net
Public NotInheritable Class InlineImage Inherits Element
Remarks
To create a new inline image, use the insert methods for inline images from theElement or Position class.
Examples
The following sample demonstrates creating a inline image at the end of a new document and retrieving the first inline image of an existing document.
C#
//--- Insert a inline image at the end of a new document
WordApplication app = new WordApplication();
Document doc = app.Create();
InlineImage image = doc.InsertImageAfter(@"C:\sample.jpg");
//--- Get the first inline image of an existing document
WordApplication app = new WordApplication();
Document doc = app.Open(@"C:\sample.doc");
InlineImage firstImage =
(InlineImage)doc.GetElements(Element.Type.InlineImage)[0];
vb.net
'--- Insert an inline image at the end of a new document
Dim app As New WordApplication()
Dim doc As Document = app.Create()
Dim image As InlineImage = doc.InsertImageAfter("C:\sample.jpg")
'--- Get the first inline image of an existing document
Dim app As New WordApplication()
Dim doc As Document = app.Open("C:\sample.doc")
Dim firstImage As InlineImage = _
doc.GetElements(Element.Type.InlineImage)(0)
Properties
Name |
Description |
|---|---|
Sets or returns an int that represents the image's height in twips. One twip = (1/20 pt) or (1/1440 in). |
|
| Sets or returns the image in its default format. | |
| Returns an InlineImage.Format object that represents the format that the image is stored as in Word. (Jpg, Png, Bmp, Gif) | |
Sets or returns an int that represents the image's width in twips. One twip = (1/20 pt) or (1/1440 in). |
Methods
Name |
Description |
|---|---|
| Returns the image in the given format. |
Nested Classes
Name |
Description |
|---|---|
| Image formats for an inline image. |
