Range Class
Represents a contiguous area in a document.
Inheritance Hierarchy
SystemObject
  Aspose.WordsRange

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public class Range

The Range type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleBookmarks
Returns a Bookmarks collection that represents all bookmarks in the range.
Public propertyFields
Returns a Fields collection that represents all fields in the range.
Public propertyCode exampleFormFields
Returns a FormFields collection that represents all form fields in the range.
Public propertyCode exampleText
Gets the text of the range.
Methods
  NameDescription
Public methodCode exampleDelete
Deletes all characters of the range.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodNormalizeFieldTypes
Changes field type values FieldType of FieldStart, FieldSeparator, FieldEnd in this range so that they correspond to the field types contained in the field codes.
Public methodCode exampleReplace(String, String)
Replaces all occurrences of a character pattern specified by a regular expression with another string.
Public methodCode exampleReplace(Regex, String)
Replaces all occurrences of a character pattern specified by a regular expression with another string.
Public methodCode exampleReplace(String, String, FindReplaceOptions)
Replaces all occurrences of a character pattern specified by a regular expression with another string.
Public methodCode exampleReplace(Regex, String, FindReplaceOptions)
Replaces all occurrences of a character pattern specified by a regular expression with another string.
Public methodToDocument
Constructs a new fully formed document that contains the range.
Public methodToString (Inherited from Object.)
Public methodCode exampleUnlinkFields
Unlinks fields in this range.
Public methodCode exampleUpdateFields
Updates the values of document fields in this range.
Remarks

The document is represented by a tree of nodes and the nodes provide operations to work with the tree, but some operations are easier to perform if the document is treated as a contiguous sequence of text.

Range is a "facade" interface that provide methods that treat the document or portions of the document as "flat" text regardless of the fact that the document nodes are stored in a tree-like object model.

Range does not contain any text or nodes, it is merely a view or "window" over a fragment of a document.

Examples
Shows how to get plain, unformatted text of a range.
Document doc = new Document(MyDir + "Document.doc");
String text = doc.Range.Text;
See Also