共用方式為


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 命名空間