Freigeben über


XMLNode.Level Property

Definition

Gets the level of the XMLNode control.

public:
 property Microsoft::Office::Interop::Word::WdXMLNodeLevel Level { Microsoft::Office::Interop::Word::WdXMLNodeLevel get(); };
public Microsoft.Office.Interop.Word.WdXMLNodeLevel Level { get; }
member this.Level : Microsoft.Office.Interop.Word.WdXMLNodeLevel
Public ReadOnly Property Level As WdXMLNodeLevel

Property Value

One of the WdXMLNodeLevel values.

Examples

The following code example uses the Level property to display the level of an XMLNode control. This example assumes that the current document contains an XMLNode named CustomerNode.

private void DisplayCustomerNodeLevel()
{
    string level = string.Empty;

    switch (this.CustomerNode.Level)
    {
        case Word.WdXMLNodeLevel.wdXMLNodeLevelCell:
            level = "cell level.";
            break;
        case Word.WdXMLNodeLevel.wdXMLNodeLevelInline:
            level = "inline level.";
            break;
        case Word.WdXMLNodeLevel.wdXMLNodeLevelParagraph:
            level = "paragraph level.";
            break;
        case Word.WdXMLNodeLevel.wdXMLNodeLevelRow:
            level = "row level.";
            break;
        default:
            level = "undeterminable level.";
            break;
    }

    MessageBox.Show("The Customer node is at " + level);
}
Private Sub DisplayCustomerNodeLevel()
    Dim level As String = String.Empty

    Select Case Me.CustomerNode.Level
        Case Word.WdXMLNodeLevel.wdXMLNodeLevelCell
            level = "cell level."
        Case Word.WdXMLNodeLevel.wdXMLNodeLevelInline
            level = "inline level."
        Case Word.WdXMLNodeLevel.wdXMLNodeLevelParagraph
            level = "paragraph level."
        Case Word.WdXMLNodeLevel.wdXMLNodeLevelRow
            level = "row level."
        Case Else
            level = "undeterminable level."
    End Select
    MsgBox("The Customer node is at " & level)
End Sub

Applies to