CompositeNodeIndexOf Method

Returns the index of the specified child node in the child node array.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 21.10.0

ExpandedSyntax

public int IndexOf(
	Node child
)

Parameters

child
Type: Aspose.WordsNode

Return Value

Type: Int32

ExpandedRemarks

Returns -1 if the node is not found in the child nodes.

ExpandedExamples

Shows how to get the index of a given child node from its parent.
Document doc = new Document(MyDir + "Rendering.docx");

Body body = doc.FirstSection.Body;

// Retrieve the index of the last paragraph in the body of the first section.
Assert.AreEqual(24, body.ChildNodes.IndexOf(body.LastParagraph));

ExpandedSee Also