indexOf method
indexOf(child)
Returns the index of the specified child node in the child node array.
indexOf(child: Aspose.Words.Node)
Parameter | Type | Description |
---|---|---|
child | Node |
Remarks
Returns -1 if the node is not found in the child nodes.
Examples
Shows how to get the index of a given child node from its parent.
let doc = new aw.Document(base.myDir + "Rendering.docx");
let body = doc.firstSection.body;
// Retrieve the index of the last paragraph in the body of the first section.
expect(body.getChildNodes(aw.NodeType.Any, false).indexOf(body.lastParagraph)).toEqual(24);
See Also
- module Aspose.Words
- class CompositeNode