CompositeNodeRemoveChild Method
Removes the specified child node.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 20.1
Syntax
public Node RemoveChild(
	Node oldChild
)

Parameters

oldChild
Type: Aspose.WordsNode
The node to remove.

Return Value

Type: Node
The removed node.
Remarks

The parent of oldChild is set to null after the node is removed.

Examples
Shows how to use of methods of Node and CompositeNode to remove a section before the last section in the document.
// Document is a CompositeNode and LastChild returns the last child node in the Document node
// Since the Document can contain only Section nodes, the last child is the last section
Node lastSection = doc.LastChild;

// Each node knows its next and previous sibling nodes
// Previous sibling of a section is a section before the specified section
// If the node is the first child, PreviousSibling will return null
Node sectionBeforeLast = lastSection.PreviousSibling;

if (sectionBeforeLast != null)
    doc.RemoveChild(sectionBeforeLast);
See Also