Aspose::Words::CompositeNode::IndexOf method

CompositeNode::IndexOf method

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

int32_t Aspose::Words::CompositeNode::IndexOf(const System::SharedPtr<Aspose::Words::Node> &child)

Examples

Shows how to get the index of a given child node from its parent.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");

SharedPtr<Body> body = doc->get_FirstSection()->get_Body();

// Retrieve the index of the last paragraph in the body of the first section.
ASSERT_EQ(24, body->GetChildNodes(Aspose::Words::NodeType::Any, false)->IndexOf(body->get_LastParagraph()));

See Also