Condividi tramite


Proprietà XmlMappedRange.XPath

Ottiene un oggetto Microsoft.Office.Interop.Excel.XPath che rappresenta l'XPath dell'elemento mappato al controllo XmlMappedRange.

Spazio dei nomi:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Sintassi

'Dichiarazione
ReadOnly Property XPath As XPath
XPath XPath { get; }

Valore proprietà

Tipo: Microsoft.Office.Interop.Excel.XPath
Oggetto Microsoft.Office.Interop.Excel.XPath che rappresenta l'XPath dell'elemento mappato al controllo XmlMappedRange.

Esempi

Nell'esempio di codice riportato di seguito viene utilizzata la proprietà XPath per rimuovere l'XPath di un oggetto XmlMappedRange se l'XPath è "/ns1:Customer/ns1:LastName".Viene quindi visualizzato l'XPath corrente del controllo XmlMappedRange.Nell'esempio si presuppone che il foglio di lavoro corrente contenga un controllo XmlMappedRange denominato 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);
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

XmlMappedRange Interfaccia

Spazio dei nomi Microsoft.Office.Tools.Excel