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 属性在 XmlMappedRange 的 XPath 为“/ns1:Customer/ns1:LastName”时移除该 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 命名空间