class Cell (View source)

Methods

updateInCollection()

Update the cell into the cell collection.

detach()

No description

attach(Cells $parent)

No description

__construct(mixed $pValue, string $pDataType, Worksheet $pSheet)

Create a new Cell.

string
getColumn()

Get cell coordinate column.

int
getRow()

Get cell coordinate row.

string
getCoordinate()

Get cell coordinate.

mixed
getValue()

Get cell value.

string
getFormattedValue()

Get cell value with formatting.

setValue(mixed $pValue)

Set cell value.

setValueExplicit(mixed $pValue, string $pDataType)

Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder).

mixed
getCalculatedValue(bool $resetLog = true)

Get calculated cell value.

setCalculatedValue(mixed $pValue)

Set old calculated value (cached).

mixed
getOldCalculatedValue()

Get old calculated value (cached) This returns the value last calculated by MS Excel or whichever spreadsheet program was used to create the original spreadsheet file.

string
getDataType()

Get cell data type.

setDataType(string $pDataType)

Set cell data type.

bool
isFormula()

Identify if the cell contains a formula.

bool
hasDataValidation()

Does this cell contain Data validation rules?

getDataValidation()

Get Data validation rules.

setDataValidation(DataValidation $pDataValidation = null)

Set Data validation rules.

bool
hasValidValue()

Does this cell contain valid value?

bool
hasHyperlink()

Does this cell contain a Hyperlink?

getHyperlink()

Get Hyperlink.

setHyperlink(Hyperlink $pHyperlink = null)

Set Hyperlink.

getParent()

Get cell collection.

getWorksheet()

Get parent worksheet.

bool
isInMergeRange()

Is this cell in a merge range.

bool
isMergeRangeValueCell()

Is this cell the master (top left cell) in a merge range (that holds the actual data value).

false|string
getMergeRange()

If this cell is in a merge range, then return the range.

getStyle()

Get cell style.

rebindParent(Worksheet $parent)

Re-bind parent.

bool
isInRange(string $pRange)

Is cell in a specific range?

static int
compareCells(Cell $a, Cell $b)

Compare 2 cells.

static IValueBinder
getValueBinder()

Get value binder to use.

static 
setValueBinder(IValueBinder $binder)

Set value binder to use.

__clone()

Implement PHP __clone to create a deep clone, not just a shallow copy.

int
getXfIndex()

Get index to cellXf.

setXfIndex(int $pValue)

Set index to cellXf.

setFormulaAttributes(mixed $pAttributes)

Set the formula attributes.

getFormulaAttributes()

Get the formula attributes.

string
__toString()

Convert to string.

Details

Cell updateInCollection()

Update the cell into the cell collection.

Return Value

Cell

detach()

attach(Cells $parent)

Parameters

Cells $parent

__construct(mixed $pValue, string $pDataType, Worksheet $pSheet)

Create a new Cell.

Parameters

mixed $pValue
string $pDataType
Worksheet $pSheet

Exceptions

Exception

string getColumn()

Get cell coordinate column.

Return Value

string

int getRow()

Get cell coordinate row.

Return Value

int

string getCoordinate()

Get cell coordinate.

Return Value

string

mixed getValue()

Get cell value.

Return Value

mixed

string getFormattedValue()

Get cell value with formatting.

Return Value

string

Cell setValue(mixed $pValue)

Set cell value.

Sets the value for a cell, automatically determining the datatype using the value binder

Parameters

mixed $pValue Value

Return Value

Cell

Exceptions

Exception

Cell setValueExplicit(mixed $pValue, string $pDataType)

Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder).

Parameters

mixed $pValue Value
string $pDataType Explicit data type, see DataType::TYPE_*

Return Value

Cell

Exceptions

Exception

mixed getCalculatedValue(bool $resetLog = true)

Get calculated cell value.

Parameters

bool $resetLog Whether the calculation engine logger should be reset or not

Return Value

mixed

Exceptions

Exception

Cell setCalculatedValue(mixed $pValue)

Set old calculated value (cached).

Parameters

mixed $pValue Value

Return Value

Cell

mixed getOldCalculatedValue()

Get old calculated value (cached) This returns the value last calculated by MS Excel or whichever spreadsheet program was used to create the original spreadsheet file.

Note that this value is not guaranteed to reflect the actual calculated value because it is possible that auto-calculation was disabled in the original spreadsheet, and underlying data values used by the formula have changed since it was last calculated.

Return Value

mixed

string getDataType()

Get cell data type.

Return Value

string

Cell setDataType(string $pDataType)

Set cell data type.

Parameters

string $pDataType see DataType::TYPE_*

Return Value

Cell

bool isFormula()

Identify if the cell contains a formula.

Return Value

bool

bool hasDataValidation()

Does this cell contain Data validation rules?

Return Value

bool

Exceptions

Exception

DataValidation getDataValidation()

Get Data validation rules.

Return Value

DataValidation

Exceptions

Exception

Cell setDataValidation(DataValidation $pDataValidation = null)

Set Data validation rules.

Parameters

DataValidation $pDataValidation

Return Value

Cell

Exceptions

Exception

bool hasValidValue()

Does this cell contain valid value?

Return Value

bool

Does this cell contain a Hyperlink?

Return Value

bool

Exceptions

Exception

Get Hyperlink.

Return Value

Hyperlink

Exceptions

Exception

Set Hyperlink.

Parameters

Hyperlink $pHyperlink

Return Value

Cell

Exceptions

Exception

Cells getParent()

Get cell collection.

Return Value

Cells

Worksheet getWorksheet()

Get parent worksheet.

Return Value

Worksheet

bool isInMergeRange()

Is this cell in a merge range.

Return Value

bool

bool isMergeRangeValueCell()

Is this cell the master (top left cell) in a merge range (that holds the actual data value).

Return Value

bool

false|string getMergeRange()

If this cell is in a merge range, then return the range.

Return Value

false|string

Style getStyle()

Get cell style.

Return Value

Style

Cell rebindParent(Worksheet $parent)

Re-bind parent.

Parameters

Worksheet $parent

Return Value

Cell

bool isInRange(string $pRange)

Is cell in a specific range?

Parameters

string $pRange Cell range (e.g. A1:A1)

Return Value

bool

static int compareCells(Cell $a, Cell $b)

Compare 2 cells.

Parameters

Cell $a Cell a
Cell $b Cell b

Return Value

int Result of comparison (always -1 or 1, never zero!)

static IValueBinder getValueBinder()

Get value binder to use.

Return Value

IValueBinder

static setValueBinder(IValueBinder $binder)

Set value binder to use.

Parameters

IValueBinder $binder

__clone()

Implement PHP __clone to create a deep clone, not just a shallow copy.

int getXfIndex()

Get index to cellXf.

Return Value

int

Cell setXfIndex(int $pValue)

Set index to cellXf.

Parameters

int $pValue

Return Value

Cell

Cell setFormulaAttributes(mixed $pAttributes)

Set the formula attributes.

Parameters

mixed $pAttributes

Return Value

Cell

getFormulaAttributes()

Get the formula attributes.

string __toString()

Convert to string.

Return Value

string