ParagraphCollectionItem Property

Retrieves a Paragraph at the given index.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public Paragraph this[
	int index
] { get; }

Parameters

index
Type: SystemInt32
An index into the collection.

Property Value

Type: Paragraph
Remarks
Remarks

The index is zero-based.

Negative indexes are allowed and indicate access from the back of the collection. For example -1 means the last item, -2 means the second before last and so on.

If index is greater than or equal to the number of items in the list, this returns a null reference.

If index is negative and its absolute value is greater than the number of items in the list, this returns a null reference.

Examples
Shows how to get paragraph that was moved (deleted/inserted) in Microsoft Word while change tracking was enabled.
Document doc = new Document(MyDir + "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