InsertRtfCommand.execute(rtfText, position) Method

Executes the InsertRtfCommand command with the specified parameters.

Declaration

execute(
    rtfText: string,
    position: number,
    subDocumentId?: number,
    callback?: (interval: Interval,
    isRtfValid: boolean) => void
): boolean

Parameters

Name Type Description
rtfText string

A string representing the RTF formatted content to insert.

position number

A value specifying the position to insert in the specified sub-document.

subDocumentId number

A value identifying the target sub-document.

callback (interval: Interval, isRtfValid: boolean) => void

A callback function that passes the inserted content’s Interval object and the bool parameter that displays whether the RTF formatted string is valid.

Returns

Type Description
boolean

true if the command has been successfully executed; false if the command execution has failed.

Remarks

Usage example:

var insertPosition = 2;
var subDocumentId = richEdit.document.mainSubDocument.id;
var callbackFunc = function (interval, isRtfValid) {}
richEdit.commands.insertRtf.execute(RTFstring, insertPosition, subDocumentId, callbackFunc);
See Also