Function TWPCustomRichText.InsertGraphic(filename:string; InsertLink:Boolean; ObjectModes:TWPTextObjModes) : TWPObject

Unit: WPCTRRich
Class: WPCTRRich.TWPCustomRichText

Parameters

Returns

The type of the result value is TWPObject.

Description

Insert an image.
If InsertLink=true the event OnRequestHTTPImage will be triggered to load the image. The property Reader will be nil in this case. If it was not possible to load the image, no object will be ionserted and the result will be nil.
It is also possible to pass initial object modes, such as [wpobjRelativeToPage] or [wpobjRelativeToParagraph] to create a movable image.

The reference to the inserted TWPTextObject is available as WPRichText1.InsertedObj after the call.
Example: var obj : TWPObject; begin obj := WPRichText1.InsertGraphic( 'someimage.png', false, [wpobjRelativeToPage] ); if obj<>nil then WPRichText1.SelectedObject := WPRichText1.InsertedObj; WPRichText1.SetFocus; end;