Properties

$valueBinder

$valueBinder : \PhpOffice\PhpSpreadsheet\Cell\IValueBinder

Value binder to use.

Type

IValueBinder

$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

$parent

$parent : \PhpOffice\PhpSpreadsheet\Collection\Cells

Collection of cells.

Type

Cells

$xfIndex

$xfIndex : int

Index to cellXf.

Type

int

$formulaAttributes

$formulaAttributes

Attributes of the formula.

Methods

updateInCollection()

updateInCollection() : $this

Update the cell into the cell collection.

Returns

$this —

detach()

detach() : void

attach()

attach(\PhpOffice\PhpSpreadsheet\Collection\Cells  $parent) : void

Parameters

\PhpOffice\PhpSpreadsheet\Collection\Cells $parent

__construct()

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

Create a new Cell.

Parameters

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

Returns

mixed —

getColumn()

getColumn() : string

Get cell coordinate column.

Returns

string —

getRow()

getRow() : int

Get cell coordinate row.

Returns

int —

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) : $this

Set cell value.

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

Parameters

mixed $pValue

Value

Returns

$this —

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

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell —

getCalculatedValue()

getCalculatedValue(bool  $resetLog = true) : mixed

Get calculated cell value.

Parameters

bool $resetLog

Whether the calculation engine logger should be reset or not

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() : bool

Identify if the cell contains a formula.

Returns

bool —

hasDataValidation()

hasDataValidation() : bool

Does this cell contain Data validation rules?

Returns

bool —

getDataValidation()

getDataValidation() : \PhpOffice\PhpSpreadsheet\Cell\DataValidation

Get Data validation rules.

Returns

\PhpOffice\PhpSpreadsheet\Cell\DataValidation —

setDataValidation()

setDataValidation(\PhpOffice\PhpSpreadsheet\Cell\DataValidation  $pDataValidation = null) : \PhpOffice\PhpSpreadsheet\Cell\Cell

Set Data validation rules.

Parameters

\PhpOffice\PhpSpreadsheet\Cell\DataValidation $pDataValidation

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell —

hasValidValue()

hasValidValue() : bool

Does this cell contain valid value?

Returns

bool —

hasHyperlink()

hasHyperlink() : bool

Does this cell contain a Hyperlink?

Returns

bool —

getHyperlink()

getHyperlink() : \PhpOffice\PhpSpreadsheet\Cell\Hyperlink

Get Hyperlink.

Returns

\PhpOffice\PhpSpreadsheet\Cell\Hyperlink —

setHyperlink()

setHyperlink(\PhpOffice\PhpSpreadsheet\Cell\Hyperlink  $pHyperlink = null) : \PhpOffice\PhpSpreadsheet\Cell\Cell

Set Hyperlink.

Parameters

\PhpOffice\PhpSpreadsheet\Cell\Hyperlink $pHyperlink

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell —

getParent()

getParent() : \PhpOffice\PhpSpreadsheet\Collection\Cells

Get cell collection.

Returns

\PhpOffice\PhpSpreadsheet\Collection\Cells —

getWorksheet()

getWorksheet() : \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

Get parent worksheet.

Returns

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet —

isInMergeRange()

isInMergeRange() : bool

Is this cell in a merge range.

Returns

bool —

isMergeRangeValueCell()

isMergeRangeValueCell() : bool

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

Returns

bool —

getMergeRange()

getMergeRange() : false|string

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

Returns

false|string —

getStyle()

getStyle() : \PhpOffice\PhpSpreadsheet\Style\Style

Get cell style.

Returns

\PhpOffice\PhpSpreadsheet\Style\Style —

rebindParent()

rebindParent(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet  $parent) : \PhpOffice\PhpSpreadsheet\Cell\Cell

Re-bind parent.

Parameters

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $parent

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell —

isInRange()

isInRange(string  $pRange) : bool

Is cell in a specific range?

Parameters

string $pRange

Cell range (e.g. A1:A1)

Returns

bool —

compareCells()

compareCells(\PhpOffice\PhpSpreadsheet\Cell\Cell  $a, \PhpOffice\PhpSpreadsheet\Cell\Cell  $b) : int

Compare 2 cells.

Parameters

\PhpOffice\PhpSpreadsheet\Cell\Cell $a

Cell a

\PhpOffice\PhpSpreadsheet\Cell\Cell $b

Cell b

Returns

int —

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

getValueBinder()

getValueBinder() : \PhpOffice\PhpSpreadsheet\Cell\IValueBinder

Get value binder to use.

Returns

\PhpOffice\PhpSpreadsheet\Cell\IValueBinder —

setValueBinder()

setValueBinder(\PhpOffice\PhpSpreadsheet\Cell\IValueBinder  $binder) : void

Set value binder to use.

Parameters

\PhpOffice\PhpSpreadsheet\Cell\IValueBinder $binder

__clone()

__clone() : mixed

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

Returns

mixed —

getXfIndex()

getXfIndex() : int

Get index to cellXf.

Returns

int —

setXfIndex()

setXfIndex(int  $pValue) : \PhpOffice\PhpSpreadsheet\Cell\Cell

Set index to cellXf.

Parameters

int $pValue

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell —

setFormulaAttributes()

setFormulaAttributes(mixed  $pAttributes) : $this

Set the formula attributes.

Parameters

mixed $pAttributes

Returns

$this —

getFormulaAttributes()

getFormulaAttributes() : mixed

Get the formula attributes.

Returns

mixed —

__toString()

__toString() : string

Convert to string.

Returns

string —