共用方式為


XmlMappedRange.AddressLocal Property

Gets the range reference of the XmlMappedRange control in the language of the user.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Syntax

'Declaration
ReadOnly Property AddressLocal As XmlMappedRange_AddressLocalType
XmlMappedRange_AddressLocalType AddressLocal { get; }

Property Value

Type: Microsoft.Office.Tools.Excel.XmlMappedRange_AddressLocalType
A string that represents the range reference of the XmlMappedRange control in the language of the user and in R1C1-style or A1-style notation.

Remarks

The AddressLocal property is intended to be used with the following parameters.

Parameter

Description

RowAbsolute

true to return the row as an absolute reference; otherwise, false. The default value is true.

ColumnAbsolute

true to return the column as an absolute reference; otherwise, false. The default value is true.

ReferenceStyle

One of the XlReferenceStyle values.

External

true to return an external reference; false to return a local reference. The default value is false.

RelativeTo

A Range that defines the starting point. If RowAbsolute and ColumnAbsolute are false, and ReferenceStyle is xlR1C1, you must include a starting point for the relative reference.

If you attempt to use AddressLocal without specifying any parameters, AddressLocal will get an XmlMappedRange_AddressLocalType object that is part of the Office development tools in Visual Studio infrastructure and is not intended to be used directly from your code.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Examples

The following code example uses the AddressLocal property to display the range location of an XmlMappedRange. The example uses different combinations of the ReferenceStyle, RowAbsolute, ColumnAbsolute and RelativeTo parameters to display the range location in four different formats. The location strings will be localized according to the language of the system it is run on. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell. If the example is run on a system using German language support and CustomerLastNameCell is at cell A2, the example will display the address strings "$A$2", "$A2", "Z2S2", and "Z[-1]S[-1]".

Private Sub DisplayAddressLocal()
    Me.Range("A1").Value2 = _
        Me.CustomerLastNameCell.AddressLocal(True, True, _
        Excel.XlReferenceStyle.xlA1, False)

    Me.Range("A2").Value2 = _
        Me.CustomerLastNameCell.AddressLocal(False, True, _
        Excel.XlReferenceStyle.xlA1, False)

    Me.Range("A3").Value2 = _
        Me.CustomerLastNameCell.AddressLocal(True, True, _
        Excel.XlReferenceStyle.xlR1C1, False)

    Me.Range("A4").Value2 = _
        Me.CustomerLastNameCell.AddressLocal(False, False, _
        Excel.XlReferenceStyle.xlR1C1, False, Me.Cells(3, 3))
End Sub
private void DisplayAddressLocal()
{
    this.Range["A1"].Value2 = 
        this.CustomerLastNameCell.AddressLocal[true,
        true, Excel.XlReferenceStyle.xlA1, false];

    this.Range["A2"].Value2 = 
        this.CustomerLastNameCell.AddressLocal[false,
        true, Excel.XlReferenceStyle.xlA1, false];

    this.Range["A3"].Value2 = 
        this.CustomerLastNameCell.AddressLocal[true,
         true, Excel.XlReferenceStyle.xlR1C1, false];

    this.Range["A4"].Value2 = 
        this.CustomerLastNameCell.AddressLocal[false,
        false, Excel.XlReferenceStyle.xlR1C1, false, this.Cells[3, 3]];
}

.NET Framework Security

See Also

Reference

XmlMappedRange Interface

Microsoft.Office.Tools.Excel Namespace