Skip to main content

InsertRtfCommand.execute(rtfText, position) Method

Executes the InsertRtfCommand command with the specified parameters.


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


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.


Type Description

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


Usage example:

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