Skip to main content

GetRtfCommand.execute(interval, callback) Method

Executes the GetRtfCommand command with the specified parameters.


    interval: Interval,
    callback: (rtf: string) => void,
    subDocumentId?: number
): boolean


Name Type Description
interval Interval

An object specifying the required interval in the specified sub-document.

callback (rtf: string) => void

A function that passes the RTF formatted string as a parameter.

subDocumentId number

A value that identifies the target sub-document (the active sub-document by default).


Type Description

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


Use this method to get a content of a sub document in RTF format. The result RTF formatted string is returned as a parameter in the callback function.


To get the content of the entire document use the DocumentManager on the server side.

// returns the rtf of the specified interval
var interval = new ASPx.Interval(2,3);
var callbackFunc = function (RTFstring) {}
var subDocumentId =;
richEdit.commands.getRtf.execute(interval, callbackFunc, subDocumentId);

// returns the rtf of an entire main sub-document
richEdit.commands.getRtf.execute(new ASPx.Interval(0, richEdit.document.mainSubDocument.length), function (rtfText) 
{ console.log(rtfText); },
See Also