ITextRange2::InsertImage method (tom.h)

Inserts an image into this range.


HRESULT InsertImage(
  [in] long    width,
  [in] long    height,
  [in] long    ascent,
  [in] long    Type,
  [in] BSTR    bstrAltText,
  [in] IStream *pStream


[in] width

Type: long

The width, in HIMETRIC units (0.01 mm), of the image.

[in] height

Type: long

The height, in HIMETRIC units, of the image.

[in] ascent

Type: long

If Type is TA_BASELINE, this parameter is the distance, in HIMETRIC units, that the top of the image extends above the text baseline. If Type is TA_BASELINE and ascent is zero, the bottom of the image is placed at the text baseline.

[in] Type

Type: long

The vertical alignment of the image. It can be one of the following values.

Value Meaning
Align the image relative to the text baseline.
Align the bottom of the image at the bottom of the text line.
Align the top of the image at the top of the text line

[in] bstrAltText

Type: BSTR

The alternate text for the image.

[in] pStream

Type: IStream

The stream that contains the image data.

Return value


If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


If the range is nondegenerate, the image replaces the text in the range.


Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header tom.h
DLL Msftedit.dll

See also