Udostępnij za pośrednictwem


Właściwość XmlMappedRange.Name —

Pobiera lub ustawia wartość przedstawiającą zdefiniowanej nazwy dla XmlMappedRange kontroli.

Przestrzeń nazw:  Microsoft.Office.Tools.Excel
Zestaw:  Microsoft.Office.Tools.Excel (w Microsoft.Office.Tools.Excel.dll)

Składnia

'Deklaracja
Property Name As Object
Object Name { get; set; }

Wartość właściwości

Typ: System.Object
A Microsoft.Office.Interop.Excel.Name obiekt, który reprezentuje zdefiniowanej nazwy dla XmlMappedRange kontroli.

Przykłady

Poniższy przykład kodu dodaje Microsoft.Office.Interop.Excel.Name odnoszącą się do komórki zajmowanych przez XmlMappedRange do bieżącego arkusza.W przykładzie następnie użyto Name właściwość, aby wyświetlić nazwę, że teraz odwołuje się do XmlMappedRange.W tym przykładzie kodu zakłada, że zawiera bieżący arkusz XmlMappedRange o nazwie CustomerLastNameCell.

Private Sub DisplayName()
    ' Get the location of the XmlMappedRange and prefix it with a "=".
    Dim location As String = Me.CustomerLastNameCell.Address( _
        True, True, Excel.XlReferenceStyle.xlA1, False)
    location = location.Insert(0, "=")

    ' Add a name at the location of the XmlMappedRange.
    Me.Names.Add("LastName", location)

    ' Get the Name of the XmlMappedRange and display the name.
    Dim name2 As Excel.Name = CType(Me.CustomerLastNameCell.Name, Excel.Name)
    MsgBox("The name of CustomerLastNameCell is: " & name2.Name)
End Sub
private void DisplayName()
{
    // Get the location of the XmlMappedRange and prefix it with a "=".
    string location = this.CustomerLastNameCell.Address[true, true,
        Excel.XlReferenceStyle.xlA1, false];
    location = location.Insert(0, "=");

    // Add a name at the location of the XmlMappedRange.
    this.Names.Add("LastName", location);

    // Get the Name of the XmlMappedRange and display the name.
    Excel.Name name2 = ((Excel.Name)this.CustomerLastNameCell.Name);
    MessageBox.Show(name2.Name);
}

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

XmlMappedRange Interfejs

Przestrzeń nazw Microsoft.Office.Tools.Excel