Compartir a través de


XmlMappedRange.XPath Property

Definition

Gets an XPath that represents the XPath of the element mapped to the XmlMappedRange control.

public:
 property Microsoft::Office::Interop::Excel::XPath ^ XPath { Microsoft::Office::Interop::Excel::XPath ^ get(); };
public Microsoft.Office.Interop.Excel.XPath XPath { get; }
member this.XPath : Microsoft.Office.Interop.Excel.XPath
Public ReadOnly Property XPath As XPath

Property Value

An XPath that represents the XPath of the element mapped to the XmlMappedRange control.

Examples

The following code example uses the XPath property to remove the XPath of an XmlMappedRange if the XPath is "/ns1:Customer/ns1:LastName". The example then displays the current XPath of the XmlMappedRange. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.

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);
    }
}
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

Applies to