node_type_to_string method

node_type_to_string(node_type)

A utility method that converts a node type enum value into a user friendly string.

def node_type_to_string(self, node_type: aspose.words.NodeType):
    ...
ParameterTypeDescription
node_typeNodeType

Examples

Shows how to use a node’s next_sibling property to enumerate through its immediate children.

doc = aw.Document(MY_DIR + 'Paragraphs.docx')
node = doc.first_section.body.first_child
while node is not None:
    print()
    print('Node type:', aw.Node.node_type_to_string(node.node_type))
    contents = node.get_text().strip()
    print('This node contains no text' if contents == '' else f'Contents: "{node.get_text().strip()}"')
    node = node.next_sibling

See Also