RunCollection Class

Provides typed access to a collection of Run nodes.
Inheritance Hierarchy

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.2
public class RunCollection : NodeCollection

The RunCollection type exposes the following members.

Public propertyCode exampleCount
Gets the number of nodes in the collection.
(Inherited from NodeCollection.)
Public propertyCode exampleItem
Retrieves a Run at the given index.
Public methodCode exampleAdd
Adds a node to the end of the collection.
(Inherited from NodeCollection.)
Public methodCode exampleClear
Removes all nodes from this collection and from the document.
(Inherited from NodeCollection.)
Public methodCode exampleContains
Determines whether a node is in the collection.
(Inherited from NodeCollection.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetEnumerator (Inherited from NodeCollection.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodCode exampleIndexOf
Returns the zero-based index of the specified node.
(Inherited from NodeCollection.)
Public methodCode exampleInsert
Inserts a node into the collection at the specified index.
(Inherited from NodeCollection.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodCode exampleRemove
Removes the node from the collection and from the document.
(Inherited from NodeCollection.)
Public methodCode exampleRemoveAt
Removes the node at the specified index from the collection and from the document.
(Inherited from NodeCollection.)
Public methodCode exampleToArray
Copies all runs from the collection to a new array of runs.
Public methodToString (Inherited from Object.)
Shows how to process revision-related properties of Inline nodes.
Document doc = new Document(MyDir + "Revision runs.docx");

// This document has 6 revisions
Assert.AreEqual(6, doc.Revisions.Count);

// The parent node of a revision is the run that the revision concerns, which is an Inline node
Run run = (Run)doc.Revisions[0].ParentNode;

// Get the parent paragraph
Paragraph firstParagraph = run.ParentParagraph;
RunCollection runs = firstParagraph.Runs;

Assert.AreEqual(6, runs.ToArray().Length);

// The text in the run at index #2 was typed after revisions were tracked, so it will count as an insert revision
// The font was changed, so it will also be a format revision

// If one node was moved from one place to another while changes were tracked,
// the node will be placed at the departure location as a "move to revision",
// and a "move from revision" node will be left behind at the origin, in case we want to reject changes
// Highlighting text and dragging it to another place with the mouse and cut-and-pasting (but not copy-pasting) both count as "move revisions"
// The node with the "IsMoveToRevision" flag is the arrival of the move operation, and the node with the "IsMoveFromRevision" flag is the departure point

// If an Inline node gets deleted while changes are being tracked, it will leave behind a node with the IsDeleteRevision flag set to true until changes are accepted
See Also