Skip to main content

InsertTextCommand.execute(text) Method

Executes the InsertTextCommand command with the specified parameters.

Declaration

execute(
    text: string,
    interval?: Interval | number,
    subDocumentId?: number
): boolean

Parameters

Name Type Description
text string

A text to insert.

interval number | Interval

A position or interval where the text is inserted.

subDocumentId number

The value that specifies the sub-document.

Returns

Type Description
boolean

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

Remarks

Note that this method does not change the selection

//Inserts a text at the end of the active sub-document
richEdit.selection.goToDocumentEnd();
richEdit.commands.insertText.execute("sometext");

If you need to access a header/footer sub-document, you can use the Section‘s Section.headers and Section.footers properties. A document’s sections are available via the RichEditDocument.sectionsInfo property.

See Also