Version

xamRichTextEditor - Recordable Methods

Topic Overview

Purpose

This topic provides information about recording and replaying actions using the xamRichTextEditor™ control’s testable user methods.

XamRichTextEditor Recordable Methods

SetCaretLocation

Description

Sets the caret location of the text.

Parameters

The following table explains the method’s parameter followed by code example.

Method parameter Description

iLocation

Zero-based integer value representing the character offset from the start of the RichTextEditor.

Example

Use the following action for setting the caret location to between the 25th and 26th characters overall.

XamRichTextEditor("Identifier").SetCaretLocation 25

Possible exceptions

None

SelectToLocation

Description

Selects all the text from the current caret position to the provided location.

Parameters

The following table explains the method’s parameter.

Method parameter Description

iLocation

Zero-based integer value representing the character offset from the start of the RichTextEditor.

Example

Use the following action for selecting from the current caret position up to between the 25th and 26th overall characters, the following action should be used.

XamRichTextEditor("Identifier").SelectToLocation 25

Possible exceptions

None

SendString

Description

Sends a string of characters to the current caret position.

Parameters

The following table explains the method’s parameter followed by code example.

Method parameter Description

sToType

String value sent to the RichTextEditor’s current caret position. NOTE:{label} It uses custom UFT character representations such as vbTab to represent tabs, and vbCRLF to represent CarriageReturn LineFeed.

Example

To send the string “Hello” to the current caret position.

XamRichTextEditor("Identifier").SendString “Hello”

To send the string “Hi,” followed by a line-feed (SHIFT + Enter); with “Bob” on the following line, and a carriage return (Enter) to start a new paragraph.

XamRichTextEditor("Identifier").SendString vbTab + “Hi,” + vbLF + “Bob” +vbCR

Possible exceptions

The following list contains the possible exceptions to this method and the likely reasons causing them.

Exception reasons

  • The operation cannot be performed because the xamRichTextEditor does not have a document loaded.

  • Editing is not allowed.

  • The text supplied was not sent because it contained a tab, which the xamRichTextEditor did not accept.

DeleteXCharacters

Description

Sends a number of Delete keys to the xamRichTextEditor 's current caret location.

Parameters

The following table explains the method’s parameter followed by code example.

Method parameter Description

iNumDeletes

Integer value representing the number of characters deleted, default value is 1.

Example

Deletes 5 characters back from the current caret location.

XamRichTextEditor("Identifier").DeleteXCharacters 5

Possible exceptions

The following list contains the possible exceptions to this method and the likely reasons causing them.

Exception reasons

  • The operation cannot be performed because the xamRichTextEditor does not have a document loaded

  • Editing is not allowed

BackspaceXCharacters

Description

Sends the number of backspace characters to the x amRichTextEditor 's current caret location.

Parameters

The following table explains the method’s parameter followed by code example.

Method parameter Description

iNumBackSpaces

Integer value representing the number of times sending the key sequence backspace, default value is 1.

Example

Starting from the current caret location press the Backspace key 5 times.

XamRichTextEditor("Identifier").BackspaceXCharacters 5

Possible exceptions

The following list contains the possible exceptions to this method and the likely reasons causing them.

Exception reasons

  • The operation cannot be performed because the xamRichTextEditor does not have a document loaded.

  • Editing is not allowed.

SetActiveView

Description

Sets the active view of the xamRichTextEditor .

Parameters

The following table explains the method’s parameter followed by code example.

Method parameter Description

oeViewLocation

A String or enumerated value of type rtedViewLocation representing the new active view location.

Example

To change the active view to the upper view location.

XamRichTextEditor("Identifier").SetActiveView rtedUpper

Possible exceptions

The possible exception to this method and the likely reasons causing it is that it cannot set the View to that view as the xamRichTextEditor view is not split.

SetSplitter

Description

Splits the view, and/or set the location of the splitter.

Parameters

The following table explains the method’s parameter followed by code examples.

Method parameter Description

iSplitterPosition

Integer value representing the pixel distance from top or left edge respectively to set the splitter. Default value is 0, which represents removing the splitter.

Example

Moves or creates a new splitter, if one did not exist before, to a position of 100 pixels.

XamRichTextEditor("Identifier").SetSplitter 100

Removes an existing splitter.

XamRichTextEditor("Identifier").SetSplitter

Possible exceptions

The possible exception to this method and the likely reason causing it is that the specified value (iSplitterPosition) is out of range.

SetZoomLevel

Description

Sets the zoom level for the editor.

Parameters

The following table explains the method’s parameter followed by code examples.

Method parameter Description

iZoomLevel

Integer value representing the percentage of zoom level. Default value is 100 (100%).

Example

Sets the zoom level to 300%.

XamRichTextEditor("Identifier").SetZoomLevel 300

Resets the zoom level to 100%.

XamRichTextEditor("Identifier").SetZoomLevel

Possible exceptions

None.

ClickHyperlink

Description

Executes a hyperlink by pressing the Ctrl key and clicking on it.

Parameters

The following table explains the method’s parameter followed by code examples.

Method parameter Description

oHyperlink

Represents either an integer value of a document offset containing a hyperlink, or a string value of the hyperlink text.

  • Recording – When there is more than one instance of a hyperlink text, it will record an integer instead

  • Replaying – When there is more than one instance, it will select the first instance

Example

Performing Ctrl+Click on a hyperlink containing a document offset of 20.

XamRichTextEditor("Identifier").ClickHyperlink 20

Performing Ctrl+Click on a hyperlink text “ Click here ”.

XamRichTextEditor("Identifier").ClickHyperlink “Click here”

Possible exceptions

The following is the list of possible exceptions to the method and the likely reason causing them.

Exception reasons

  • There was no hyperlink found at the document offset [oHyperlink]

  • There was no hyperlink found with the text [oHyperlink]

  • The supplied Hyperlink argument [oHyperlink] is not one of the expected type(s) listed here: String or Int1

ApplyCharacterSetting

Description

Sets the text formatting based on the current caret position.

Parameters

The following table explains the method’s parameter followed by code example.

Method parameter Description

oeCharacterSetting

String command name or enumerated value representing the text formatting setting.

Example

Changes the currently selected text to Bold.

XamRichTextEditor("Identifier").ApplyCharacterSetting rtedBold

Possible exceptions

The following list contains the possible exceptions to this method and the likely reasons causing them.

Exception reasons

  • The option supplied is not the [rtedCharacterSettings], the only valid option

  • The operation cannot be performed because the xamRichTextEditor does not have a document loaded.

  • Editing is not allowed.

RemoveCharacterSetting

Description

Removes the text formatting based on caret position.

Parameters

The following table explains the method’s parameter followed by a code example.

Method parameter Description

oeCharacterSetting

String command name or enumerated value representing the text formatting setting.

Example

Removes Bold text setting from the currently selected text to Bold.

XamRichTextEditor("Identifier").RemoveCharacterSetting rtedBold

Possible exceptions

The following list contains the possible exceptions to this method and the likely reasons causing them.

Exception reasons

  • The option supplied is not the valid [rtedCharacterSettings] option

  • The operation cannot be performed because the x amRichTextEditor does not have a document loaded

  • Editing is not allowed

ApplyParagraphSetting

Description

Sets the text alignment based on caret position.

Parameters

The following table explains the method’s parameter followed by code example.

Method parameter Description

oeParagraphSetting

String command name or enumerated value representing the text alignment.

Example

Aligns the paragraph to the left.

XamRichTextEditor("Identifier").ApplyParagraphSetting rtedAlignLeft

Possible exceptions

The following list contains the possible exceptions to this method and the likely reasons causing them.

Exception reasons

  • The option supplied is not a valid [rtedParagraphSettings]option

  • The operation cannot be performed because the xamRichTextEditor does not have a document loaded

  • Editing is not allowed

ExecuteCommand

Description

Executes the supplied command.

Parameters

The following table explains the method’s parameter followed by code example.

Method parameter Description

oeCommandId

String command name or enumerated value representing the command name.

Example

To copy the selected text to the clipboard.

XamRichTextEditor("Identifier").ExecuteCommand rtedCopy

Possible exceptions

The possible exceptions to this method are that the option supplied is not one of the valid options, valid options are [{0}]

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic provides information about the xamRichTextEditor control’s testable user actions and elements.

This topic provides information about the XamRichTextEditor control’s testable user replay-only methods.

This topic provides reference information about the xamRichTextEditor control’s test object properties.

This topic provides reference material on the common enumerations used for testing the xamRichTextEditor control.