Table of Contents

Class ExcelAddressBase

Namespace
OfficeOpenXml
Assembly
EPPlus.dll

A range address

public class ExcelAddressBase : ExcelCellBase
Inheritance
ExcelAddressBase
Derived
Inherited Members

Remarks

Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5"

Constructors

ExcelAddressBase(int, int, int, int)

Creates an Address object

public ExcelAddressBase(int fromRow, int fromCol, int toRow, int toColumn)

Parameters

fromRow int

start row

fromCol int

start column

toRow int

End row

toColumn int

End column

ExcelAddressBase(int, int, int, int, bool, bool, bool, bool)

Creates an Address object

public ExcelAddressBase(int fromRow, int fromCol, int toRow, int toColumn, bool fromRowFixed, bool fromColFixed, bool toRowFixed, bool toColFixed)

Parameters

fromRow int

Start row

fromCol int

Start column

toRow int

End row

toColumn int

End column

fromRowFixed bool

Start row fixed

fromColFixed bool

Start column fixed

toRowFixed bool

End row fixed

toColFixed bool

End column fixed

ExcelAddressBase(int, string, int, int, int, int)

Creates an address object

public ExcelAddressBase(int externalReferenceIx, string worksheetName, int fromRow, int fromCol, int toRow, int toColumn)

Parameters

externalReferenceIx int

Index of an external reference

worksheetName string

Worksheet name

fromRow int

Start row

fromCol int

Start column

toRow int

End row

toColumn int

End column

ExcelAddressBase(string, ExcelPackage, ExcelAddressBase)

Creates an Address object

public ExcelAddressBase(string address, ExcelPackage pck, ExcelAddressBase referenceAddress)

Parameters

address string

The Excel Address

pck ExcelPackage

Reference to the package to find information about tables and names

referenceAddress ExcelAddressBase

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

public ExcelAddressBase(string address, ExcelWorkbook wb = null, string wsName = null)

Parameters

address string

The Excel Address

wb ExcelWorkbook

The workbook to verify any defined names from

wsName string

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, int, int, int, int)

Creates an Address object

public ExcelAddressBase(string worksheetName, int fromRow, int fromCol, int toRow, int toColumn)

Parameters

worksheetName string

Worksheet name

fromRow int

Start row

fromCol int

Start column

toRow int

End row

toColumn int

End column

Properties

Address

The address for the range

public virtual string Address { get; }

Property Value

string

AddressAbsolute

The \(absolute\) address

public string AddressAbsolute { get; }

Property Value

string

Columns

Number of columns int the address

public int Columns { get; }

Property Value

int

End

Gets the row and column of the bottom right cell.

public ExcelCellAddress End { get; }

Property Value

ExcelCellAddress

The end row column.

ExternalReferenceIndex

The index to the external reference. Return 0, the current workbook, if no reference exists.

public int ExternalReferenceIndex { get; }

Property Value

int

FullAddress

The full address including the worksheet

public string FullAddress { get; }

Property Value

string

IsExternal

Returns true the address contains an external reference

public bool IsExternal { get; }

Property Value

bool

IsFullColumn

Returns true if the range spans a full column

public bool IsFullColumn { get; }

Property Value

bool

IsFullRow

Returns true if the range spans a full row

public bool IsFullRow { get; }

Property Value

bool

IsName

If the address is a defined name

public bool IsName { get; }

Property Value

bool

LocalAddress

The address without the workbook or worksheet reference

public string LocalAddress { get; }

Property Value

string

Rows

Number of rows int the address

public int Rows { get; }

Property Value

int

Start

Gets the row and column of the top left cell.

public ExcelCellAddress Start { get; }

Property Value

ExcelCellAddress

The start row column.

Table

If the address is refering a table, this property contains additional information

public ExcelTableAddress Table { get; }

Property Value

ExcelTableAddress

Methods

BeforeChangeAddress()

Method for actions that must be taken before address is changed

protected virtual void BeforeChangeAddress()

ChangeAddress()

Called when the address changes

protected virtual void ChangeAddress()

Equals(object)

Returns true if the item is equal to another item.

public override bool Equals(object obj)

Parameters

obj object

The item to compare

Returns

bool

True if the items are equal

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

SetAddress(string, ExcelWorkbook, string)

Sets the address

protected void SetAddress(string address, ExcelWorkbook wb, string wsName)

Parameters

address string

The address

wb ExcelWorkbook
wsName string

ToString()

Returns the address text

public override string ToString()

Returns

string

Validate()

Validate the address

protected void Validate()