Compartir a través de


IHTMLTxtRange interface

This interface enables you to access the TextRange object in an HTML element.

Members

The IHTMLTxtRange interface inherits from the IDispatch interface. IHTMLTxtRange also has these types of members:

  • Methods
  • Properties

Methods

The IHTMLTxtRange interface has these methods.

Method Description
compareEndPoints

Compares an end point of a TextRange object with an end point of another range.

duplicate

Returns a duplicate of the TextRange.

execCommand

Executes a command on the current document, current selection, or the given range.

execCommandShowHelp

Displays help information for the given command identifier.

expand

Expands the range so that partial units are completely contained.

findText

Searches for text in the document and positions the start and end points of the range to encompass the search string.

getBookmark

Retrieves a bookmark (opaque string) that can be used with IHTMLTxtRange::moveToBookmark to return to the same range.

inRange

Returns a value indicating whether one range is contained within another.

isEqual

Returns a value indicating 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 end position of the range.

moveStart

Changes the start position of the range.

moveToBookmark

Moves to a bookmark.

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.

pasteHTML

Pastes HTML text into the given text range, replacing any previous text and HTML elements in the range.

queryCommandEnabled

Returns a Boolean value that indicates whether a specified command can be successfully executed using IHTMLTxtRange::execCommand, given the current state of the document.

queryCommandIndeterm

Returns a Boolean value that indicates whether the specified command is in the indeterminate state.

queryCommandState

Returns a Boolean value that indicates the current state of the command.

queryCommandSupported

Returns a Boolean value that indicates whether the current command is supported on the current range.

queryCommandText

Retrieves the string associated with a command.

queryCommandValue

Returns the current value of the document, range, or current selection for the given command.

scrollIntoView

Causes the object to scroll into view, aligning it either at the top or bottom of the window.

select

Makes the selection equal to the current object.

setEndPoint

Sets the endpoint of one range based on the endpoint of another range.

 

Properties

The IHTMLTxtRange interface has these properties.

Property Description

htmlText

Retrieves the HTML source as a valid HTML fragment.

text

Sets or retrieves the text contained within the range.

 

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 IHTMLBodyElement::createTextRange, IHTMLInputHiddenElement::createTextRange, IHTMLInputTextElement::createTextRange, IHTMLTextAreaElement::createTextRange, or IHTMLButtonElement::createTextRange. You can modify the extent of the text range by moving its start and end positions with methods such as IHTMLTxtRange::move, IHTMLTxtRange::moveToElementText, and IHTMLTxtRange::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.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IDispatch