GetChildNodes

StructuredDocumentTagRangeStart.GetChildNodes method

Returnerar en livesamling av underordnade noder som matchar de angivna typerna.

public NodeCollection GetChildNodes(NodeType nodeType, bool isDeep)

Exempel

Visar hur man får barnnoder för StructuredDocumentTagRangeStart.

Document doc = new Document(MyDir + "Multi-section structured document tags.docx");
StructuredDocumentTagRangeStart tag =
    doc.GetChildNodes(NodeType.StructuredDocumentTagRangeStart, true)[0] as StructuredDocumentTagRangeStart;

Console.WriteLine("StructuredDocumentTagRangeStart values:");
Console.WriteLine($"\t|Child nodes count: {tag.GetChildNodes(NodeType.Any, false).Count}\n");

foreach (Node node in tag.GetChildNodes(NodeType.Any, false))
    Console.WriteLine($"\t|Child node type: {node.NodeType}");

foreach (Node node in tag.GetChildNodes(NodeType.Run, true))
    Console.WriteLine($"\t|Child node text: {node.GetText()}");

Se även