Class ExcelAddressBase
A range address
Inherited Members
Namespace: OfficeOpenXml
Assembly: EPPlus.dll
Syntax
public class ExcelAddressBase : ExcelCellBase
Remarks
Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5"
Constructors
ExcelAddressBase(Int32, Int32, Int32, Int32)
Creates an Address object
Declaration
public ExcelAddressBase(int fromRow, int fromCol, int toRow, int toColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | fromRow | start row |
| System.Int32 | fromCol | start column |
| System.Int32 | toRow | End row |
| System.Int32 | toColumn | End column |
ExcelAddressBase(Int32, Int32, Int32, Int32, Boolean, Boolean, Boolean, Boolean)
Creates an Address object
Declaration
public ExcelAddressBase(int fromRow, int fromCol, int toRow, int toColumn, bool fromRowFixed, bool fromColFixed, bool toRowFixed, bool toColFixed)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | fromRow | Start row |
| System.Int32 | fromCol | Start column |
| System.Int32 | toRow | End row |
| System.Int32 | toColumn | End column |
| System.Boolean | fromRowFixed | Start row fixed |
| System.Boolean | fromColFixed | Start column fixed |
| System.Boolean | toRowFixed | End row fixed |
| System.Boolean | toColFixed | End column fixed |
ExcelAddressBase(Int32, String, Int32, Int32, Int32, Int32)
Creates an address object
Declaration
public ExcelAddressBase(int externalReferenceIx, string worksheetName, int fromRow, int fromCol, int toRow, int toColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | externalReferenceIx | Index of an external reference |
| System.String | worksheetName | Worksheet name |
| System.Int32 | fromRow | Start row |
| System.Int32 | fromCol | Start column |
| System.Int32 | toRow | End row |
| System.Int32 | toColumn | End column |
ExcelAddressBase(String, ExcelPackage, ExcelAddressBase)
Creates an Address object
Declaration
public ExcelAddressBase(string address, ExcelPackage pck, ExcelAddressBase referenceAddress)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | address | The Excel Address |
| ExcelPackage | pck | Reference to the package to find information about tables and names |
| ExcelAddressBase | referenceAddress | The address |
Remarks
Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5"
ExcelAddressBase(String, ExcelWorkbook, String)
Creates an Address object
Declaration
public ExcelAddressBase(string address, ExcelWorkbook wb = null, string wsName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | address | The Excel Address |
| ExcelWorkbook | wb | The workbook to verify any defined names from |
| System.String | wsName | The name of the worksheet the address referes to |
Remarks
Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5"
ExcelAddressBase(String, Int32, Int32, Int32, Int32)
Creates an Address object
Declaration
public ExcelAddressBase(string worksheetName, int fromRow, int fromCol, int toRow, int toColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | worksheetName | Worksheet name |
| System.Int32 | fromRow | Start row |
| System.Int32 | fromCol | Start column |
| System.Int32 | toRow | End row |
| System.Int32 | toColumn | End column |
Properties
Address
The address for the range
Declaration
public virtual string Address { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
AddressAbsolute
The $absolute$ address
Declaration
public string AddressAbsolute { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Columns
Number of columns int the address
Declaration
public int Columns { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
End
Gets the row and column of the bottom right cell.
Declaration
public ExcelCellAddress End { get; }
Property Value
| Type | Description |
|---|---|
| ExcelCellAddress | The end row column. |
ExternalReferenceIndex
The index to the external reference. Return 0, the current workbook, if no reference exists.
Declaration
public int ExternalReferenceIndex { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
FullAddress
The full address including the worksheet
Declaration
public string FullAddress { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
IsExternal
Returns true the address contains an external reference
Declaration
public bool IsExternal { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsFullColumn
Returns true if the range spans a full column
Declaration
public bool IsFullColumn { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsFullRow
Returns true if the range spans a full row
Declaration
public bool IsFullRow { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsName
If the address is a defined name
Declaration
public bool IsName { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
LocalAddress
The address without the workbook or worksheet reference
Declaration
public string LocalAddress { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Rows
Number of rows int the address
Declaration
public int Rows { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Start
Gets the row and column of the top left cell.
Declaration
public ExcelCellAddress Start { get; }
Property Value
| Type | Description |
|---|---|
| ExcelCellAddress | The start row column. |
Table
If the address is refering a table, this property contains additional information
Declaration
public ExcelTableAddress Table { get; }
Property Value
| Type | Description |
|---|---|
| ExcelTableAddress |
Methods
BeforeChangeAddress()
Method for actions that must be taken before address is changed
Declaration
protected virtual void BeforeChangeAddress()
ChangeAddress()
Called when the address changes
Declaration
protected virtual void ChangeAddress()
Equals(Object)
Returns true if the item is equal to another item.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The item to compare |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the items are equal |
Overrides
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | A hash code for the current object. |
Overrides
SetAddress(String, ExcelWorkbook, String)
Sets the address
Declaration
protected void SetAddress(string address, ExcelWorkbook wb, string wsName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | address | The address |
| ExcelWorkbook | wb | |
| System.String | wsName |
ToString()
Returns the address text
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |
Overrides
Validate()
Validate the address
Declaration
protected void Validate()