Właściwość XmlMappedRange.Name —
Pobiera lub ustawia wartość reprezentującą zdefiniowaną nazwę 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 zdefiniowaną nazwę dla XmlMappedRange kontroli.
Przykłady
Poniższy kod dodaje Microsoft.Office.Interop.Excel.Name odwołujący się do komórki zajmowanych przez XmlMappedRange do bieżącego arkusza.Następnie w przykładzie Name właściwość, aby wyświetlić nazwę, że teraz odnosi się do XmlMappedRange.W tym przykładzie kodu zakłada, że bieżący arkusz zawiera 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
- Pełne zaufanie do bezpośredniego wywołującego. Tego elementu członkowskiego nie można używać w kodzie częściowo zaufanym. Aby uzyskać więcej informacji, zobacz Używanie bibliotek pochodzących z częściowo zaufanego kodu.