Forums     Knowledge Base     OfficeWriter Online     
 
 
This documentation is for
OfficeWriter v3.8.1
.NET Platform

View Docs for Another
Version or Platform

Programmer's Reference > WordApplication API > InlineImage

The InlineImage Object

     extends Element



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 InlineElements of an Element.

To create a new inline image, use the insert methods for inline images from the Element or Position class.

To get an existing inline image, use the Element.Elements property and check which elements are of type Element.Type.InlineImage.

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.



Examples:

[csharp]
// 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 = doc.Elements(Element.Type.InlineImage)[0];
[vbnet]
' 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.Elements(Element.Type.InlineImage)(0)


Please note that this object inherits methods and properties not shown here from the following objects:

InlineImage Enumerations

NameDescription
InlineImage.Format

Image formats for an inline image



InlineImage Properties

Property Type Access Description
Height int read
write

Sets or returns an int that represents the image's height in twips

Image (overloaded) read
write

Sets or returns the image

ImageFormat InlineImage.Format read

Returns an InlineImage.Format object that represents the format that the image is stored as in Word

Width int read
write

Sets or returns an int that represents the image's width in twips



This object does not have any methods defined.



Copyright 2007 © SoftArtisans, Inc. All Rights Reserved.