共用方式為


XmlMappedRange.XPath 屬性

取得 Microsoft.Office.Interop.Excel.XPath,表示與 XmlMappedRange 控制項對應之元素的 XPath。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel (在 Microsoft.Office.Tools.Excel.dll 中)

語法

'宣告
ReadOnly Property XPath As XPath
    Get
XPath XPath { get; }

屬性值

型別:Microsoft.Office.Interop.Excel.XPath
Microsoft.Office.Interop.Excel.XPath 表示與 XmlMappedRange 控制項對應之元素的 XPath。

範例

下列程式碼範例使用 XPath 屬性,如果 XPath 為 "/ns1:Customer/ns1:LastName",則移除 XmlMappedRange 的 XPath。 然後該範例會顯示 XmlMappedRange 目前的 XPath。 這個程式碼範例假設目前工作表包含名為 CustomerLastNameCell 的 XmlMappedRange

Private Sub RemoveXPath()
    If Me.CustomerLastNameCell.XPath.Value = _
        "/ns1:Customer/ns1:LastName" Then
        Me.CustomerLastNameCell.XPath.Clear()
        MsgBox("Removed matching XPath.")
    End If

    If Me.CustomerLastNameCell.XPath.Value = Nothing Then
        MsgBox("The XmlMappedRange has no XPath.")
    Else
        MsgBox("The XPath of the XmlMappedRange is " & _
            Me.CustomerLastNameCell.XPath.Value)
    End If
End Sub
private void DisplayXPath()
{
    if (this.CustomerLastNameCell.XPath.Value ==
        "/ns1:Customer/ns1:LastName")
    {
        this.CustomerLastNameCell.XPath.Clear();
        MessageBox.Show("Removed mathing XPath.");
    }

    if (this.CustomerLastNameCell.XPath.Value == null)
    {
        MessageBox.Show("The XmlMappedRange has no XPath.");
    }
    else
    {
        MessageBox.Show("The XPath of the XmlMappedRange is " +
            this.CustomerLastNameCell.XPath.Value);
    }
}

.NET Framework 安全性

請參閱

參考

XmlMappedRange 介面

Microsoft.Office.Tools.Excel 命名空間