Sdílet prostřednictvím


DocumentBase.XMLNodes – vlastnost

Získá Microsoft.Office.Interop.Word.XMLNodes kolekce, která představuje souhrn všech prvků XML v dokumentu.

Obor názvů:  Microsoft.Office.Tools.Word
Sestavení:  Microsoft.Office.Tools.Word.v4.0.Utilities (v Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntaxe

'Deklarace
Public ReadOnly Property XMLNodes As XMLNodes
public XMLNodes XMLNodes { get; }

Hodnota vlastnosti

Typ: Microsoft.Office.Interop.Word.XMLNodes
A Microsoft.Office.Interop.Word.XMLNodes kolekce, která představuje souhrn všech prvků XML v dokumentu.

Příklady

Následující příklad kódu zobrazuje názvy všech Microsoft.Office.Interop.Word.XMLNodes objekty v dokumentu.Chcete-li tento příklad použít, spusťte jej ze třídy ThisDocument v projektu na úrovni dokumentu.

Private Sub DocumentXMLNodes()
    Dim stringBuilder1 As New System.Text.StringBuilder()

    ' Add all of the node names to the StringBuilder.
    Dim node As Word.XMLNode
    For Each node In Me.XMLNodes
        stringBuilder1.Append(node.BaseName & ", ")
    Next node

    ' End the StringBuilder with a period.
    stringBuilder1.Remove(stringBuilder1.Length - 2, 2)
    stringBuilder1.Append(".")

    MessageBox.Show("The document contains " & Me.XMLNodes.Count.ToString() _
        & " node(s): " & stringBuilder1.ToString())
End Sub 
private void DocumentXMLNodes()
{
    System.Text.StringBuilder stringBuilder1 =
        new System.Text.StringBuilder();

    // Add all of the node names to the StringBuilder.
    foreach (Word.XMLNode node in this.XMLNodes)
    {
        stringBuilder1.Append(node.BaseName + ", ");
    }

    // End the StringBuilder with a period.
    stringBuilder1.Remove(stringBuilder1.Length - 2, 2);
    stringBuilder1.Append(".");

    MessageBox.Show("The document contains " +
        this.XMLNodes.Count.ToString() + " node(s): " +
        stringBuilder1.ToString());
}

Zabezpečení rozhraní .NET Framework

Viz také

Referenční dokumentace

DocumentBase Třída

Microsoft.Office.Tools.Word – obor názvů