コード例 #1
0
        public void RemoveChild()
        {
            Aspose.Words.Document doc = new Aspose.Words.Document();

            //ExStart
            //ExFor:CompositeNode.LastChild
            //ExFor:Node.PreviousSibling
            //ExFor:CompositeNode.RemoveChild
            //ExSummary:Demonstrates 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.
            Aspose.Words.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.
            Aspose.Words.Node sectionBeforeLast = lastSection.PreviousSibling;

            if (sectionBeforeLast != null)
            {
                doc.RemoveChild(sectionBeforeLast);
            }
            //ExEnd
        }
コード例 #2
0
ファイル: ExNode.cs プロジェクト: animaal/Aspose_Words_NET
        public void RemoveChild()
        {
            Aspose.Words.Document doc = new Aspose.Words.Document();

            //ExStart
            //ExFor:CompositeNode.LastChild
            //ExFor:Node.PreviousSibling
            //ExFor:CompositeNode.RemoveChild
            //ExSummary:Demonstrates 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.
            Aspose.Words.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.
            Aspose.Words.Node sectionBeforeLast = lastSection.PreviousSibling;

            if (sectionBeforeLast != null)
                doc.RemoveChild(sectionBeforeLast);
            //ExEnd
        }