GetChildNodes

StructuredDocumentTagRangeStart.GetChildNodes method

Renvoie une collection active de nœuds enfants qui correspondent aux types spécifiés.

public NodeCollection GetChildNodes(NodeType nodeType, bool isDeep)

Exemples

Montre comment obtenir des nœuds enfants de 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()}");

Voir également