ParagraphCollection Class
Provides typed access to a collection of Paragraph nodes.
Inheritance Hierarchy

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
Syntax
public class ParagraphCollection : NodeCollection

The ParagraphCollection type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleCount
Gets the number of nodes in the collection.
(Inherited from NodeCollection.)
Public propertyCode exampleItem
Retrieves a Paragraph at the given index.
Methods
  NameDescription
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 methodContains
Determines whether a node is in the collection.
(Inherited from NodeCollection.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetEnumerator (Inherited from NodeCollection.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodCode exampleIndexOf
Returns the zero-based index of the specified node.
(Inherited from NodeCollection.)
Public methodInsert
Inserts a node into the collection at the specified index.
(Inherited from NodeCollection.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRemove
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 paragraphs from the collection to a new array of paragraphs.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Examples
Shows how to get paragraph that was moved (deleted/inserted) in Microsoft Word while change tracking was enabled.
[C#]

Document doc = new Document(MyDir + "Document.Revisions.docx");
ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

// There are two sets of move revisions in this document
// One moves a small part of a paragraph, while the other moves a whole paragraph
// Paragraph.IsMoveFromRevision/IsMoveToRevision will only be true if a whole paragraph is moved, as in the latter case
for (int i = 0; i < paragraphs.Count; i++)
{
    if (paragraphs[i].IsMoveFromRevision)
        Console.WriteLine("The paragraph {0} has been moved (deleted).", i);
    if (paragraphs[i].IsMoveToRevision)
        Console.WriteLine("The paragraph {0} has been moved (inserted).", i);
}
See Also