Share via


TextRange Object Members

SharePoint Designer Developer Reference

Represents a range or selection of text and elements in an HTML document.

Methods

  Name Description
collapse Moves the insertion point to the beginning or end of a range.
compareEndPoints Compares an end point of an TextRange object with an end point of another TextRange object. Returns a Long that represents the comparison of the specified points.
duplicate Returns a TextRange object that represents a copy of another range.
execCommand Executes a specified action on the current document, current selection, or the specified range, and then returns a Boolean that indicates whether the command completed successfully.
expand Expands the range so that partial units are completely contained and returns a Boolean that represents whether the method was successful.
findText Searches for text in the document, positions the start and end points of the range to encompass the search string, and returns a Boolean that represents whether the search was successful.
getBookmark Returns a String that represents the start and end positions of an TextRange object.
inRange Returns True if the TextRange object specified in the range argument is contained in the original range.
isEqual Returns True if the TextRange object specified in the range argument is the same as the original TextRange object.
move Collapses a TextRange object to the start of the range, and then moves the insertion point from the starting point in the range by the specified number of units. Returns a Long that represents the number of units moved.
moveEnd Moves the ending position of a TextRange object. Returns a Long that represents the number of units moved.
moveStart Moves the starting position of a TextRange object. Returns a Long that represents the number of units moved.
moveToBookmark Returns True if the specified TextRange object has moved to the String specified in the Bookmark argument.
moveToElementText Moves the specified TextRange object to the HTML element specified in the element argument.
moveToPoint Moves the start and end positions of a TextRange object to the specified point.
parentElement Returns an IHTMLElement object that represents the element that is one level up in the HTML element hierarchy.
pasteHTML Pastes the specified HTML into a range within a document. If anything is selected, the selection is replaced with the new HTML and text.
queryCommandEnabled Returns a Boolean that indicates if the specified command can be executed.
queryCommandIndeterm Returns a Boolean that determines if the specified command will return an indeterminate state.
queryCommandState Returns a Boolean that indicates the state of the specified command. If True, the specified command has already been carried out on the current selection. If False, the specified command has not yet been carried out on the current selection.
queryCommandText Returns a String that represents a text value associated with the specified command.
queryCommandValue Returns a String that indicates the value of the specified command.
scrollIntoView Scrolls the page so a range of text and elements is positioned at the top of the page window.
select Selects the text in the specified TextRange object.
setEndPoint Sets the end point of one range based on the end point of another range.

Properties

  Name Description
htmlText Returns a String that represents the HTML contained in the specified TextRange object or, if the selected text contains no HTML, returns the selected text with the HTML for the parent element.
text Returns or sets a String that represents the text without HTML elements within a range.