Properties

$value

$value : mixed

Value of the cell.

Type

mixed

$calculatedValue

$calculatedValue : mixed

Calculated value of the cell (used for caching) 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.

Type

mixed

$dataType

$dataType : string

Type of the cell data.

Type

string

$xfIndex

$xfIndex : integer

Index to cellXf.

Type

integer

$formulaAttributes

$formulaAttributes : 

Attributes of the formula.

Type

Methods

updateInCollection()

updateInCollection() : self

Update the cell into the cell collection.

Returns

self

detach()

detach() 

__construct()

__construct(mixed  $pValue, string  $pDataType, \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet  $pSheet) 

Create a new Cell.

Parameters

mixed $pValue
string $pDataType
\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pSheet

Throws

\PhpOffice\PhpSpreadsheet\Exception

getColumn()

getColumn() : string

Get cell coordinate column.

Returns

string

getRow()

getRow() : integer

Get cell coordinate row.

Returns

integer

getCoordinate()

getCoordinate() : string

Get cell coordinate.

Returns

string

getValue()

getValue() : mixed

Get cell value.

Returns

mixed

getFormattedValue()

getFormattedValue() : string

Get cell value with formatting.

Returns

string

setValue()

setValue(mixed  $pValue) : \PhpOffice\PhpSpreadsheet\Cell\Cell

Set cell value.

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

Parameters

mixed $pValue

Value

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell

setValueExplicit()

setValueExplicit(mixed  $pValue, string  $pDataType) : \PhpOffice\PhpSpreadsheet\Cell\Cell

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_*

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell

getCalculatedValue()

getCalculatedValue(boolean  $resetLog = true) : mixed

Get calculated cell value.

Parameters

boolean $resetLog

Whether the calculation engine logger should be reset or not

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

mixed

setCalculatedValue()

setCalculatedValue(mixed  $pValue) : \PhpOffice\PhpSpreadsheet\Cell\Cell

Set old calculated value (cached).

Parameters

mixed $pValue

Value

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell

getOldCalculatedValue()

getOldCalculatedValue() : mixed

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.

Returns

mixed

getDataType()

getDataType() : string

Get cell data type.

Returns

string

setDataType()

setDataType(string  $pDataType) : \PhpOffice\PhpSpreadsheet\Cell\Cell

Set cell data type.

Parameters

string $pDataType

see DataType::TYPE_*

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell

isFormula()

isFormula() : boolean

Identify if the cell contains a formula.

Returns

boolean

hasDataValidation()

hasDataValidation() : boolean

Does this cell contain Data validation rules?

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

boolean

hasValidValue()

hasValidValue() : boolean

Does this cell contain valid value?

Returns

boolean

hasHyperlink()

hasHyperlink() : boolean

Does this cell contain a Hyperlink?

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

boolean

isInMergeRange()

isInMergeRange() : boolean

Is this cell in a merge range.

Returns

boolean

isMergeRangeValueCell()

isMergeRangeValueCell() : boolean

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

Returns

boolean

getMergeRange()

getMergeRange() : string

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

Returns

string

isInRange()

isInRange(string  $pRange) : boolean

Is cell in a specific range?

Parameters

string $pRange

Cell range (e.g. A1:A1)

Returns

boolean

__clone()

__clone() 

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

getXfIndex()

getXfIndex() : integer

Get index to cellXf.

Returns

integer

setFormulaAttributes()

setFormulaAttributes(mixed  $pAttributes) : \PhpOffice\PhpSpreadsheet\Cell\Cell

Set the formula attributes.

Parameters

mixed $pAttributes

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell

getFormulaAttributes()

getFormulaAttributes() 

Get the formula attributes.

__toString()

__toString() : string

Convert to string.

Returns

string