XmlMappedRange.Address Property
Gets the range reference of the XmlMappedRange control.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
ReadOnly Property Address As XmlMappedRange_AddressType
XmlMappedRange_AddressType Address { get; }
Property Value
Type: Microsoft.Office.Tools.Excel.XmlMappedRange_AddressType
A string that represents the range reference of the XmlMappedRange control in R1C1-style or A1-style notation.
Remarks
The Address 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 Address without specifying any parameters, Address will get an XmlMappedRange_AddressType 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 Address 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. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell. If CustomerLastNameCell is at cell A2, the example will display the address strings "$A$2", "$A2", "R2C2", and "R[-1]C[-1]".
Private Sub DisplayAddress()
Me.Range("A1").Value2 = _
Me.CustomerLastNameCell.Address(True, True, _
Excel.XlReferenceStyle.xlA1, False)
Me.Range("A2").Value2 = _
Me.CustomerLastNameCell.Address(False, True, _
Excel.XlReferenceStyle.xlA1, False)
Me.Range("A3").Value2 = _
Me.CustomerLastNameCell.Address(True, True, _
Excel.XlReferenceStyle.xlR1C1, False)
Me.Range("A4").Value2 = _
Me.CustomerLastNameCell.Address(False, False, _
Excel.XlReferenceStyle.xlR1C1, False, Me.Cells(3, 3))
End Sub
private void DisplayAddress()
{
this.Range["A1"].Value2 =
this.CustomerLastNameCell.Address[true, true,
Excel.XlReferenceStyle.xlA1, false];
this.Range["A2"].Value2 =
this.CustomerLastNameCell.Address[false, true,
Excel.XlReferenceStyle.xlA1, false];
this.Range["A3"].Value2 =
this.CustomerLastNameCell.Address[true, true,
Excel.XlReferenceStyle.xlR1C1, false];
this.Range["A4"].Value2 =
this.CustomerLastNameCell.Address[false, false,
Excel.XlReferenceStyle.xlR1C1, false, this.Cells[3, 3]];
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.