Partager via


XmlMappedRange.XPath, propriété

Obtient un Microsoft.Office.Interop.Excel.XPath qui représente le XPath de l'élément mappé au contrôle XmlMappedRange.

Espace de noms :  Microsoft.Office.Tools.Excel
Assembly :  Microsoft.Office.Tools.Excel (dans Microsoft.Office.Tools.Excel.dll)

Syntaxe

'Déclaration
ReadOnly Property XPath As XPath
XPath XPath { get; }

Valeur de propriété

Type : Microsoft.Office.Interop.Excel.XPath
Microsoft.Office.Interop.Excel.XPath qui représente le XPath de l'élément mappé au contrôle XmlMappedRange.

Exemples

L'exemple de code suivant utilise la propriété XPath pour supprimer le XPath de XmlMappedRange si XPath correspond à "/ns1:Customer/ns1:LastName". L'exemple affiche ensuite le XPath actuel de XmlMappedRange. Cet exemple de code suppose que la feuille de calcul active contient un contrôle XmlMappedRange nommé CustomerLastNameCell.

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

Sécurité .NET Framework

Voir aussi

Référence

XmlMappedRange Interface

Microsoft.Office.Tools.Excel, espace de noms