Class DocumentRange
A contiguous span of sibling nodes — inlines inside one paragraph, or blocks inside one section, cell, header, footer or note — that can be copied, moved or deleted as a unit.
A range is a snapshot of positions, not a live cursor. It captures the nodes it spans when it is created; editing the document afterwards can leave it describing a span that no longer exists, and the operations then throw rather than silently doing something else.
Moving honors the model's one-parent invariant: a move detaches every node and re-adds it, and never produces a node reachable from two parents. Copying deep-clones, so the copy shares no mutable state with the original.
public sealed class DocumentRange
- Inheritance
-
DocumentRange
- Inherited Members
- Extension Methods
Properties
- Count
Gets the number of nodes in the range.
- Nodes
Gets the nodes in the range, in document order.
- Parent
Gets the node whose child collection the range spans.
Methods
- CloneNodes()
Deep-clones the range's nodes without attaching them to anything.
- CopyTo(DomNode, int)
Inserts deep copies of the range into another host, leaving the original in place.
- Delete()
Removes the range's nodes from the document. The nodes themselves stay usable and can be re-inserted elsewhere.
- FromBlocks(Block, Block)
Creates a range spanning two blocks and everything between them, inclusive.
- FromInlines(Inline, Inline)
Creates a range spanning two inlines and everything between them, inclusive.
- GetText(RevisionView)
Extracts the plain text of the range, with the same rules as GetText(DomNode, RevisionView).
- MoveTo(DomNode, int)
Moves the range into another host: every node is detached from its current parent and re-added at the destination, in order. Moving within the same collection is supported.