## Node::GetAncestor method


Gets the first ancestor of the specified [NodeType](../../nodetype/).

```cpp
System::SharedPtr<Aspose::Words::CompositeNode> Aspose::Words::Node::GetAncestor(Aspose::Words::NodeType ancestorType)
```


| Parameter | Type | Description |
| --- | --- | --- |
| ancestorType | Aspose::Words::NodeType | The node type of the ancestor to retrieve. |

### ReturnValue

The ancestor of the specified type or **null** if no ancestor of this type was found.

## See Also

* Class [CompositeNode](../../compositenode/)
* Enum [NodeType](../../nodetype/)
* Class [Node](../)
* Namespace [Aspose::Words](../../)
* Library [Aspose.Words for C++](../../../)
