Click or drag to resize
TextRange Class
Represents a range of text in a document in the Text Object Model (TOM).
Inheritance Hierarchy

Namespace: TextObjectModel
Assembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax
public class TextRange : IDisposable, IEquatable<TextRange>, 
	ICloneable

The TextRange type exposes the following members.

Methods
  NameDescription
Public methodAddSubrange
(TOM 2 only) Adds a subrange to this range.
Public methodCode exampleBuildUpMath
(TOM 2 only) Converts the linear-format math in a range to a built-up form, or modifies the current built-up form.
Public methodCode exampleChangeCase
Changes the case of letters in this range according to the type parameter.
Public methodCode exampleClone
Gets a duplicate of this range object.
Public methodCode exampleCollapse
Collapses the specified text range into a degenerate point at either the beginning or end of the range.
Public methodCopy
Copies the text to the clipboard.
Public methodCut
Cuts the plain or rich text to the clipboard.
Public methodDelete
Mimics the DELETE and BACKSPACE keys, with and without the CTRL key depressed.
Public methodDeleteSubrange
(TOM 2 only) Deletes a subrange from the range.
Public methodDispose
Releases all resources used by the TextRange
Protected methodDispose(Boolean)
Releases the unmanaged resources used by the TextRange and optionally releases the managed resources
Public methodCode exampleEndOf
Moves this range's ends to the end of the last overlapping unit in the range.
Public methodEquals(Object)
Tests if this object is considered equal to another.
(Overrides ObjectEquals(Object).)
Public methodEquals(TextRange)
Determines whether this range has the same character positions and story as those of a specified range.
Public methodCode exampleExpand
Expands this range so that any partial units it contains are completely contained.
Protected methodFinalize (Overrides ObjectFinalize.)
Public methodFind
(TOM 2 only) Searchs for math inline functions in text as specified by a source range.
Public methodCode exampleFindText(String, RangeMatchType)
Searches to the end of the story for the text given by text. The matching criteria are given by flags.
Public methodCode exampleFindText(String, Int32, RangeMatchType)
Searches up to count characters for the text given by text. The starting position and direction are also specified by count, and the matching criteria are given by flags.
Public methodFindTextEnd(String, RangeMatchType)
Searches to the end of the story for text, starting from the range's end.
Public methodFindTextEnd(String, Int32, RangeMatchType)
Searches up to count characters for text, starting from the range's end.
Public methodFindTextStart(String, RangeMatchType)
Searches to the end of the story for text, starting at the range's start.
Public methodFindTextStart(String, Int32, RangeMatchType)
Searches up to count characters for text, starting at the range's start.
Public methodGetCells
(TOM 2 only) Gets the cells in the range.
Public methodGetChar
(TOM 2 only) Gets the character at the specified offset from the end of this range.
Public methodGetColumn
(TOM 2 only) Gets the column in the range.
Public methodCode exampleGetDataObject
Returns an IDataObject containing the text in the range.
Public methodGetDropCap
(TOM 2 only) Gets the line and position of the drop cap.
Public methodGetEmbeddedObject
Retrieves the embedded object at the start of the specified range. The range must either be an insertion point or it must select only the embedded object.
Public methodGetHashCode
Returns the hash code for the object.
(Overrides ObjectGetHashCode.)
Public methodGetIndex
Retrieves the story index of the unit parameter at the specified range start character position. The first unit in a story has an index value of 1. The index of a Unit is the same for all character positions from that immediately preceding the unit up to the last character in the unit.
Public methodGetMathFunctionType
(TOM 2 only) Retrieves the math function type associated with the specified math function name.
Public methodGetPoint
Retrieves screen coordinates for the start or end character position in the text range, along with the intra-line position.
Public methodGetProperty
(TOM 2 only) Gets the value of a property.
Public methodGetRectangle
(TOM 2 only) Retrieves a rectangle of the specified type for the current range.
Public methodGetRow
(TOM 2 only) Gets the row properties in the currently selected row.
Public methodGetSubrange
(TOM 2 only) Retrieves a subrange in a range.
Public methodGetTable
(TOM 2 only) Gets the table in the range.
Public methodGetText
(TOM 2 only) Gets the text in this range according to the specified conversion flags.
Public methodHexToUnicode
(TOM 2 only) Converts and replaces the hexadecimal number at the end of this range to a Unicode character.
Public methodInRange
Determines whether this range is within or at the same text as a specified range.
Public methodCode exampleInsertImage
(TOM 2 only) Inserts a table in a range.
Public methodInsertTable
(TOM 2 only) Inserts a table in a range.
Public methodCode exampleLinearize
(TOM 2 only) Translates the built-up math, ruby, and other inline objects in this range to linearized form.
Public methodCode exampleMove
Moves the insertion point forward or backward a specified number of units. If the range is nondegenerate, the range is collapsed to an insertion point at either end, depending on count, and then is moved.
Public methodCode exampleMoveEnd
Moves the end position of the range.
Public methodCode exampleMoveEndUntil
Moves the range's end to the character position of the first character found that is in the set of characters specified by chars.
Public methodCode exampleMoveEndWhile
Moves the end of the range just past all contiguous characters that are found in the set of characters specified by chars, whichever is less.
Public methodCode exampleMoveStart
Moves the start position of the range.
Public methodCode exampleMoveStartUntil
Moves the range's start to the character position of the first character found that is in the set of characters specified by chars.
Public methodCode exampleMoveStartWhile
Moves the start position of the range just past all contiguous characters that are found in the set of characters specified by chars.
Public methodCode exampleMoveUntil
Searches for the first character in the set of characters specified by chars. If a character is found, the range is collapsed to that point.
Public methodCode exampleMoveWhile
Starts at the end of the range and searches while the characters belong to the set specified by chars. The range is collapsed to an insertion point when a non-matching character is found.
Public methodPaste
Pastes text from the clipboard.
Public methodScrollIntoView
Scrolls the range into view.
Public methodSelect
Sets the start and end positions, and story values of the active selection, to those of this range.
Public methodSetActiveSubrange
(TOM 2 only) Makes the specified subrange the active subrange of this range.
Public methodCode exampleSetDataObject
Replaces the text in the range with the specified data object.
Public methodSetDropCap
(TOM 2 only) Sets the line and position of the drop cap.
Public methodSetFormattedText
Sets the formatted text of this range text to the formatted text of the specified range.
Public methodSetIndex
Changes this range to the specified unit of the story.
Public methodSetPoint
Changes the range based on a specified point at or up through (depending on extend) the point (x, y) aligned according to position.
Public methodSetProperty
(TOM 2 only) Sets the value of the specified property.
Public methodSetRange
Adjusts the range endpoints to the specified values.
Public methodSetText
(TOM 2 only) Sets the text of this range.
Public methodCode exampleStartOf
Moves the range ends to the start of the first overlapping Unit in the range.
Public methodToString
Returns the plain text in the range.
(Overrides ObjectToString.)
Public methodUnicodeToHex
(TOM 2 only) Converts the Unicode character(s) preceding the start position of this text range to a hexadecimal number, and selects it.
Top
Extension Methods
  NameDescription
Public Extension MethodAppend
Appends text to the end of the range.
(Defined by TextExtensions.)
Public Extension MethodAppendLine
Appends text, followed by a newline character, to the end of the range.
(Defined by TextExtensions.)
Public Extension MethodClear
Clears the text in the range.
(Defined by TextExtensions.)
Public Extension MethodInsert
Inserts text at the specified position within the range.
(Defined by TextExtensions.)
Public Extension MethodRemove
Removes a sequence of characters from the range.
(Defined by TextExtensions.)
Public Extension MethodCode exampleToMathML
Returns a string containing the W3C MathML (MML) markup for the math text in the range.
(Defined by TextExtensions.)
Public Extension MethodCode exampleToOfficeMathML
Returns a string containing the Office MathML (OMML) markup for the math text in the range.
(Defined by TextExtensions.)
Top
Properties
  NameDescription
Public propertyCanEdit
Gets a value determining whether the specified range can be edited.
Public propertyCanPaste
Gets a value determining if data on the clipboard can be pasted into the current range.
Public propertyChar
Gets or sets the character at the start position of the range.
Public propertyEnd
Gets or sets the end character position of the range.
Public propertyFont
Gets or sets a TextFont object with the character attributes of the specified range.
Public propertyGravity
(TOM 2 only) Gets or sets the gravity of this range.
Public propertyCode exampleInlineObject
(TOM 2 only) Gets or sets the properties of the inline object at the range active end.
Public propertyLength
Gets or sets the length of the range.
Public propertyPara
Gets or sets a TextPara object with the paragraph attributes of the specified range.
Public propertyRtf
Gets or sets the content of the range as a Rich Text Format (RTF) string.
Public propertyStart
Gets or sets the start character position of the range.
Public propertyStartPara
(TOM 2 only) Gets the character position of the start of the paragraph that contains the range's start character position.
Public propertySubrangeCount
(TOM 2 only) Gets the count of subranges, including the active subrange in the current range.
Public propertyText
Gets or sets the plain text in this range.
Public propertyURL
(TOM 2 only) Gets or sets the URL text associated with a range.
Top
Remarks

Managed wrapper class for the COM interface ITextRange, including ITextRange2 functionality.

Ranges are the primary mechanism for reading and manipulating text in TOM. A range provides access to the content and formatting options for the rich text bounded by a particular start and end position.

A range can be obtained by:

See Also