ChangeHyperlinkCommand.execute(fieldIndex, hyperlinkSettings) Method
Executes the ChangeHyperlinkCommand command by applying the specified settings.
May result in taking no action if the command’s state does not allow command execution. Use the object’s getState method to check the command state.
Declaration
execute(
fieldIndex: number,
hyperlinkSettings: HyperlinkSettings,
subDocumentId?: number
): boolean
Parameters
Name | Type | Description |
---|---|---|
fieldIndex | number | An integer value specifying the field’s index in the specified sub-document. |
hyperlinkSettings | HyperlinkSettings | An object specifying the hyperlink’s properties. |
subDocumentId | number | A nullable value specifying the sub-document. |
Returns
Type | Description |
---|---|
boolean | A Boolean value identifying whether method execution was successful or failed. |
Remarks
The execute method checks the command state (obtained using the getState method) before executing, and decides whether the action can be performed.
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