public void GetNodeTypeEnums()
{
//ExStart
//ExFor:Paragraph.NodeType
//ExFor:Table.NodeType
//ExFor:Node.NodeType
//ExFor:Footnote.NodeType
//ExFor:FormField.NodeType
//ExFor:SmartTag.NodeType
//ExFor:Cell.NodeType
//ExFor:Row.NodeType
//ExFor:Document.NodeType
//ExFor:Comment.NodeType
//ExFor:Run.NodeType
//ExFor:Section.NodeType
//ExFor:SpecialChar.NodeType
//ExFor:Shape.NodeType
//ExFor:FieldEnd.NodeType
//ExFor:FieldSeparator.NodeType
//ExFor:FieldStart.NodeType
//ExFor:BookmarkStart.NodeType
//ExFor:CommentRangeEnd.NodeType
//ExFor:BuildingBlock.NodeType
//ExFor:GlossaryDocument.NodeType
//ExFor:BookmarkEnd.NodeType
//ExFor:GroupShape.NodeType
//ExFor:CommentRangeStart.NodeType
//ExId:GetNodeTypeEnums
//ExSummary:Shows how to retrieve the NodeType enumeration of nodes.
Document doc = new Document(MyDir + "Document.doc");
// Let's pick a node that we can't be quite sure of what type it is.
// In this case lets pick the first node of the first paragraph in the body of the document
Node node = doc.FirstSection.Body.FirstParagraph.FirstChild;
Console.WriteLine("NodeType of first child: " + Node.NodeTypeToString(node.NodeType));
// This time let's pick a node that we know the type of. Create a new paragraph and a table node.
Paragraph para = new Paragraph(doc);
Table table = new Table(doc);
// Access to NodeType for typed nodes will always return their specific NodeType.
// i.e A paragraph node will always return NodeType.Paragraph, a table node will always return NodeType.Table.
Console.WriteLine("NodeType of Paragraph: " + Node.NodeTypeToString(para.NodeType));
Console.WriteLine("NodeType of Table: " + Node.NodeTypeToString(table.NodeType));
//ExEnd
}