Class ExcelCellBase
Base class containing cell address manipulating methods.
Inherited Members
Namespace: OfficeOpenXml
Assembly: EPPlus.dll
Syntax
public abstract class ExcelCellBase
Methods
GetAddress(Int32, Boolean, Int32, Boolean)
Returns the AlphaNumeric representation that Excel expects for a Cell Address
Declaration
public static string GetAddress(int Row, bool AbsoluteRow, int Column, bool AbsoluteCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Row | The number of the row |
System.Boolean | AbsoluteRow | Absolute row |
System.Int32 | Column | The number of the column in the worksheet |
System.Boolean | AbsoluteCol | Absolute column |
Returns
Type | Description |
---|---|
System.String | The cell address in the format A1 |
GetAddress(Int32, Int32)
Returns the AlphaNumeric representation that Excel expects for a Cell Address
Declaration
public static string GetAddress(int Row, int Column)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Row | The number of the row |
System.Int32 | Column | The number of the column in the worksheet |
Returns
Type | Description |
---|---|
System.String | The cell address in the format A1 |
GetAddress(Int32, Int32, Boolean)
Returns the AlphaNumeric representation that Excel expects for a Cell Address
Declaration
public static string GetAddress(int Row, int Column, bool Absolute)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Row | The number of the row |
System.Int32 | Column | The number of the column in the worksheet |
System.Boolean | Absolute | Get an absolute address ($A$1) |
Returns
Type | Description |
---|---|
System.String | The cell address in the format A1 |
GetAddress(Int32, Int32, Int32, Int32)
Returns the AlphaNumeric representation that Excel expects for a Cell Address
Declaration
public static string GetAddress(int FromRow, int FromColumn, int ToRow, int ToColumn)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | FromRow | From row number |
System.Int32 | FromColumn | From column number |
System.Int32 | ToRow | To row number |
System.Int32 | ToColumn | From column number |
Returns
Type | Description |
---|---|
System.String | The cell address in the format A1 |
GetAddress(Int32, Int32, Int32, Int32, Boolean)
Returns the AlphaNumeric representation that Excel expects for a Cell Address
Declaration
public static string GetAddress(int FromRow, int FromColumn, int ToRow, int ToColumn, bool Absolute)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | FromRow | From row number |
System.Int32 | FromColumn | From column number |
System.Int32 | ToRow | To row number |
System.Int32 | ToColumn | From column number |
System.Boolean | Absolute | if true address is absolute (like $A$1) |
Returns
Type | Description |
---|---|
System.String | The cell address in the format A1 |
GetAddress(Int32, Int32, Int32, Int32, Boolean, Boolean, Boolean, Boolean)
Returns the AlphaNumeric representation that Excel expects for a Cell Address
Declaration
public static string GetAddress(int FromRow, int FromColumn, int ToRow, int ToColumn, bool FixedFromRow, bool FixedFromColumn, bool FixedToRow, bool FixedToColumn)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | FromRow | From row number |
System.Int32 | FromColumn | From column number |
System.Int32 | ToRow | To row number |
System.Int32 | ToColumn | From column number |
System.Boolean | FixedFromRow | |
System.Boolean | FixedFromColumn | |
System.Boolean | FixedToRow | |
System.Boolean | FixedToColumn |
Returns
Type | Description |
---|---|
System.String | The cell address in the format A1 |
GetAddressCol(Int32, Boolean)
Get the columnn address for the column
Declaration
public static string GetAddressCol(int Col, bool Absolute = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Col | The column |
System.Boolean | Absolute | If the column is absolute. Adds a $ before the address if true |
Returns
Type | Description |
---|---|
System.String |
GetAddressRow(Int32, Boolean)
Get the row number in text
Declaration
public static string GetAddressRow(int Row, bool Absolute = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Row | The row |
System.Boolean | Absolute | If the row is absolute. Adds a $ before the address if true |
Returns
Type | Description |
---|---|
System.String |
GetColumnLetter(Int32)
Returns the character representation of the numbered column
Declaration
protected static string GetColumnLetter(int iColumnNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iColumnNumber | The number of the column |
Returns
Type | Description |
---|---|
System.String | The letter representing the column |
GetColumnLetter(Int32, Boolean)
Returns the character representation of the numbered column
Declaration
protected static string GetColumnLetter(int iColumnNumber, bool fixedCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iColumnNumber | The number of the column |
System.Boolean | fixedCol | True for fixed column |
Returns
Type | Description |
---|---|
System.String | The letter representing the column |
GetFullAddress(String, String)
Get the full address including the worksheet name
Declaration
public static string GetFullAddress(string worksheetName, string address)
Parameters
Type | Name | Description |
---|---|---|
System.String | worksheetName | The name of the worksheet |
System.String | address | The address |
Returns
Type | Description |
---|---|
System.String | The full address |
GetFullAddress(String, String, String)
Get the full address including the worksheet name
Declaration
public static string GetFullAddress(string workbook, string worksheetName, string address)
Parameters
Type | Name | Description |
---|---|---|
System.String | workbook | The workbook, if other than current |
System.String | worksheetName | The name of the worksheet |
System.String | address | The address |
Returns
Type | Description |
---|---|
System.String | The full address |
IsSimpleAddress(String)
If the address is a address is a cell or range address of format A1 or A1:A2, without specified worksheet name.
Declaration
public static bool IsSimpleAddress(string address)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | the address |
Returns
Type | Description |
---|---|
System.Boolean | True if valid. |
IsValidAddress(String)
Returns true if the cell address is valid
Declaration
public static bool IsValidAddress(string address)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | The address to check |
Returns
Type | Description |
---|---|
System.Boolean | Return true if the address is valid |
IsValidCellAddress(String)
Checks that a cell address (e.g. A5) is valid.
Declaration
public static bool IsValidCellAddress(string cellAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | cellAddress | The alphanumeric cell address |
Returns
Type | Description |
---|---|
System.Boolean | True if the cell address is valid |
TranslateFromR1C1(String, Int32, Int32)
Translates a R1C1 to an absolut address/Formula
Declaration
public static string TranslateFromR1C1(string value, int row, int col)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | Address |
System.Int32 | row | Current row |
System.Int32 | col | Current column |
Returns
Type | Description |
---|---|
System.String | The RC address |
TranslateToR1C1(String, Int32, Int32)
Translates a absolut address to R1C1 Format
Declaration
public static string TranslateToR1C1(string value, int row, int col)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | R1C1 Address |
System.Int32 | row | Current row |
System.Int32 | col | Current column |
Returns
Type | Description |
---|---|
System.String | The absolut address/Formula |