Skip to main content

ChangeHyperlinkCommand.execute(fieldIndex, hyperlinkSettings) Method

Executes the ChangeHyperlinkCommand command with the specified parameters.

Declaration

execute(
    fieldIndex: number,
    hyperlinkSettings: HyperlinkSettings,
    subDocumentId?: number
): boolean

Parameters

Name Type Description
fieldIndex number

The field’s index in the specified sub-document.

hyperlinkSettings HyperlinkSettings

An object specifying the hyperlink’s properties.

subDocumentId number

A 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

Usage example:

var field = richEdit.document.activeSubDocument.findFields(richEdit.selection.intervals[0].start)[0];
if (field && field.isHyperlink){
    var hyperlinkSettings = new ASPx.HyperlinkSettings ("google.com", "", "click me", "go to google");
    richEdit.commands.changeHyperlink.execute(field.index, hyperlinkSettings);
}

Use the Field.isHyperlink property to determine whether the specified field is a hyperlink.

See Also