Skip to main content

GetRtfCommand.execute(interval, callback) Method

Executes the GetRtfCommand command with the specified parameters.

Declaration

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

Parameters

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).

Returns

Type Description
boolean

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

Remarks

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.

Important

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.document.mainSubDocument.id;
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); }, richEdit.document.mainSubDocument.id)
See Also