The IHTMLTxtRange interface provides the ability to access the TextRange object in an HTML element.
IHTMLTxtRange Methods
collapse Creates an empty range either at the beginning or end of the current range. compareEndPoints Compares two end points and returns -1, 0, or 1 for less than, equal to, or greater than, respectively. duplicate Creates a duplicate of the range. execCommand Executes the given command over the current selection or text range. execCommandShowHelp Displays help information for the given command identifier. expand Expands the range so that partial units are contained within the range. findText Searches for text in the given range. Positions the start and end points of the range to encompass the search string. get_htmlText Retrieves the HTML source as a valid HTML fragment. get_text Retrieves the text contained within the text range. getBookmark Retrieves a bookmark (opaque string) that can be used with the moveToBookmark method to return to the same range. inRange Determines whether the specified range is within or equal to the current range. isEqual Determines whether the specified range is equal to the current range. move Collapses the given text range and moves the empty range by the given number of units. moveEnd Changes the scope of the range by moving the end position of the range. moveStart Changes the scope of the range by moving the start position of the range. moveToBookmark Moves to a bookmark. Bookmarks are opaque strings that are created with the getBookmark method. moveToElementText Moves the text range so that the start and end positions of the range encompass the text in the given element. moveToPoint Moves the start and end positions of the text range to the given point. parentElement Retrieves the parent element for the given text range. The parent element is the element that completely encloses the text in the range. pasteHTML Pastes HTML text into the given text range. The text completely replaces any previous text and HTML elements in the range. put_text Sets the text contained within the text range. queryCommandEnabled Determines whether the given command is currently available. queryCommandIndeterm Determines whether the given command is in the indeterminate state. queryCommandState Retrieves the current status of the given command. The status indicates whether the command has been carried out on the object. queryCommandSupported Determines whether the given command is supported. queryCommandText Returns the string associated with a command. queryCommandValue Retrieves the current value of the given command. scrollIntoView Scrolls the range into view, aligning it at either the top or bottom of the window. select Makes the active selection equal to the current object. setEndPoint Sets the end point of one text range based on the end point of another.
Interface Information
Implementation System (Mshtml.dll) Inherits from IDispatch Header and IDL files Mshtml.h, Mshtml.idl Minimum availability Internet Explorer 4.0 Minimum operating systems Windows 95, Windows NT 4.0
Windows CE
Windows CE Use version 2.12 and later Minimum availability Internet Explorer 4.0
Remarks
The IHTMLTxtRange interface is used to retrieve and modify text in an element, locate specific strings in the text, and carry out commands that affect the appearance of the text.
You retrieve a TextRange object by using the createTextRange method of the IHTMLBodyElement, IHTMLInputHiddenElement, IHTMLInputTextElement, IHTMLTextAreaElement, or IHTMLButtonElement interfaces. You can modify the extent of the text range by moving its start and end positions with methods such as move, moveToElementText, and findText. Within the text range, you can retrieve and modify plain text or HTML text. These forms of text are identical except that HTML text includes HTML tags; plain text does not.