NodePreviousPreOrder Method
Gets the previous node according to the pre-order tree traversal algorithm.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public Node PreviousPreOrder(
	Node rootNode
)

Parameters

rootNode
Type: Aspose.WordsNode
The top node (limit) of traversal.

Return Value

Type: Node
Previous node in pre-order order. Null if reached the rootNode.
Examples
Shows how to delete all images from a document using pre-order tree traversal.
Node curNode = doc;
while (curNode != null)
{
    Node nextNode = curNode.NextPreOrder(doc);

    if (curNode.PreviousPreOrder(doc) != null && nextNode != null)
    {
        Assert.AreEqual(curNode, nextNode.PreviousPreOrder(doc));
    }

    if (curNode.NodeType.Equals(NodeType.Shape))
    {
        Shape shape = (Shape) curNode;

        // Several shape types can have an image including image shapes and OLE objects.
        if (shape.HasImage)
            shape.Remove();
    }

    curNode = nextNode;
}
See Also