TX Text Control ActiveX

ImageInsert Method

Method

This method inserts a new image anchored to a paragraph. The text flows around the image.

Introduced: 12.0.

Syntax

TXTextControl.ImageInsert FileName, TextPos, Alignment, PosX, PosY, ScaleX, ScaleY, TextFlow, DistanceL, DistanceT, DistanceR, DistanceB

Parameters

ParameterDescription
FileNameSpecifies the image file with a full path name.
TextPosSpecifies a text position in the paragraph where the image should be inserted. If TextPos is -1, the image is anchored to the paragraph at the current input position.
AlignmentSpecifies the image's horizontal alignment. It can be one of the following values:
PosXSpecifies the image's horizontal position in twips, relative to the left border of the paragraph. This value is used if the Alignment parameter has been set to 0.
PosYSpecifies the image's vertical position in twips relative to the top border of the paragraph.
ScaleXSpecifies a horizontal scaling factor as a percentage.
ScaleYSpecifies a vertical scaling factor as a percentage.
TextFlowSpecifies how text flows around the image. It can be one of the following values:
DistanceL, DistanceT, DistanceR, DistanceBSpecifies distances, in twips, between the image and the document's text.

Alignment

ValueDescription
0The horizontal position is given through the PosX parameter.
1The image is left aligned relative to the paragraph to which it is anchored.
2The image is right aligned relative to the paragraph to which it is anchored.
3The image is centered relative to the paragraph to which it is anchored.

TextFlow

ValueDescription
2The text stops at the top and continues at the bottom of the image.
3The text flows around the image. Empty areas at the left and right side are filled.

Return Value

The method returns the image's identifier, if a new image could be inserted. Otherwise, it returns zero. The image's identifier can also be obtained with the ObjectCurrent property.

Data Types

NameData type
FileNameString
TextPosLong
AlignmentInteger
PosXLong
PosYLong
ScaleXInteger
ScaleYInteger
TextFlowInteger
DistanceLInteger
DistanceTInteger
DistanceRInteger
DistanceBInteger
Return valueInteger

See Also