XMLNode.Level 属性

获取 XMLNode 控件的级别。

命名空间:  Microsoft.Office.Tools.Word
程序集:  Microsoft.Office.Tools.Word(在 Microsoft.Office.Tools.Word.dll 中)

语法

声明
ReadOnly Property Level As WdXMLNodeLevel
    Get
WdXMLNodeLevel Level { get; }

属性值

类型:Microsoft.Office.Interop.Word.WdXMLNodeLevel
WdXMLNodeLevel 值之一。

示例

下面的代码示例使用 Level 属性显示 XMLNode 控件的级别。 此示例假定当前文档包含一个名为 CustomerNode 的 XMLNode

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 安全性

请参见

参考

XMLNode 接口

Microsoft.Office.Tools.Word 命名空间