Click or drag to resize
TextRangeInsertImage Method
(TOM 2 only) Inserts a table in a range.

Namespace: TextObjectModel
Assembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax
public void InsertImage(
	int width,
	int height,
	int ascent,
	VerticalPosition vPos,
	string altText,
	Stream stream
)

Parameters

width
Type: SystemInt32
The width, in HIMETRIC units (0.01 mm), of the image.
height
Type: SystemInt32
The height, in HIMETRIC units, of the image.
ascent
Type: SystemInt32
If vPos is Baseline, this parameter is the distance, in HIMETRIC units, that the top of the image extends above the text baseline. If vPos is Baseline and ascent is zero, the bottom of the image is placed at the text baseline.
vPos
Type: TextObjectModelVerticalPosition
The vertical alignment of the image.
altText
Type: SystemString
The alternate text for the image.
stream
Type: System.IOStream
The stream that contains the image data.
Exceptions
ExceptionCondition
NotSupportedException The underlying COM object does not implement the ITextRange2 interface.
ArgumentNullExceptionstream is null.
Remarks
This method makes a copy of the data in the stream. It is the caller's responsibility to close the original stream.
Examples
The following example demonstrates how to insert an image into a range:
C#
void InsertImageExample(TextRange range, string fileName) {
    using (Stream stream = File.OpenRead(fileName)) {
        range.InsertImage(
            4000, 
            3000, 
            0, 
            VerticalPosition.Baseline, 
            "Example text", 
            stream
        );
    }
}
See Also