Partager via


XMLNode.Level Property

Gets the level of the XMLNode control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Syntax

'Declaration
ReadOnly Property Level As WdXMLNodeLevel
WdXMLNodeLevel Level { get; }

Property Value

Type: Microsoft.Office.Interop.Word.WdXMLNodeLevel
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 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
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);
}

.NET Framework Security

See Also

Reference

XMLNode Interface

Microsoft.Office.Tools.Word Namespace