Cell
in package
implements
Stringable
Table of Contents
Interfaces
- Stringable
Constants
Properties
- $calculateDateTimeType : int
- $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.
- $dataType : string
- Type of the cell data.
- $formulaAttributes : null|array<string, string>
- Attributes of the formula.
- $ignoredErrors : IgnoredErrors
- $parent : Cells|null
- The collection of cells that this cell belongs to (i.e. The Cell Collection for the parent Worksheet).
- $value : mixed
- Value of the cell.
- $valueBinder : IValueBinder|null
- Value binder to use.
- $xfIndex : int
- Index to the cellXf reference for the styling of this cell.
Methods
- __clone() : mixed
- Implement PHP __clone to create a deep clone, not just a shallow copy.
- __construct() : mixed
- Create a new Cell.
- __toString() : string
- Convert to string.
- attach() : void
- compareCells() : int
- Compare 2 cells.
- detach() : void
- getAppliedStyle() : Style
- Get cell style.
- getCalculateDateTimeType() : int
- getCalculatedValue() : mixed
- Get calculated cell value.
- getCalculatedValueString() : string
- Get calculated cell value converted to string.
- getColumn() : string
- Get cell coordinate column.
- getCoordinate() : string
- Get cell coordinate.
- getDataType() : string
- Get cell data type.
- getDataValidation() : DataValidation
- Get Data validation rules.
- getFormattedValue() : string
- Get cell value with formatting.
- getFormulaAttributes() : null|array<string, string>
- Get the formula attributes.
- getHyperlink() : Hyperlink
- Get Hyperlink.
- getIgnoredErrors() : IgnoredErrors
- getMergeRange() : false|string
- If this cell is in a merge range, then return the range.
- 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.
- getParent() : Cells|null
- Get cell collection.
- getRow() : int
- Get cell coordinate row.
- getStyle() : Style
- Get cell style.
- getValue() : mixed
- Get cell value.
- getValueBinder() : IValueBinder
- Get value binder to use.
- getValueString() : string
- getWorksheet() : Worksheet
- Get parent worksheet.
- getWorksheetOrNull() : Worksheet|null
- getXfIndex() : int
- Get index to cellXf.
- hasDataValidation() : bool
- Does this cell contain Data validation rules?
- hasHyperlink() : bool
- Does this cell contain a Hyperlink?
- hasValidValue() : bool
- Does this cell contain valid value?
- isFormula() : bool
- Identify if the cell contains a formula.
- isHiddenOnFormulaBar() : bool
- isInMergeRange() : bool
- Is this cell in a merge range.
- isInRange() : bool
- Is cell in a specific range?
- isLocked() : bool
- isMergeRangeValueCell() : bool
- Is this cell the master (top left cell) in a merge range (that holds the actual data value).
- rebindParent() : self
- Re-bind parent.
- setCalculateDateTimeType() : void
- setCalculatedValue() : self
- Set old calculated value (cached).
- setDataType() : self
- Set cell data type.
- setDataValidation() : self
- Set Data validation rules.
- setFormulaAttributes() : $this
- Set the formula attributes.
- setHyperlink() : self
- Set Hyperlink.
- setValue() : self
- Set cell value.
- setValueBinder() : void
- Set value binder to use.
- setValueExplicit() : self
- Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder).
- setXfIndex() : self
- Set index to cellXf.
- updateInCollection() : self
- Update the cell into the cell collection.
- updateIfCellIsTableHeader() : void
- convertDateTimeInt() : mixed
- Convert date, time, or datetime from int to float if desired.
Constants
CALCULATE_DATE_TIME_ASIS
public
mixed
CALCULATE_DATE_TIME_ASIS
= 0
CALCULATE_DATE_TIME_FLOAT
public
mixed
CALCULATE_DATE_TIME_FLOAT
= 1
CALCULATE_TIME_FLOAT
public
mixed
CALCULATE_TIME_FLOAT
= 2
Properties
$calculateDateTimeType
private
static int
$calculateDateTimeType
= self::CALCULATE_DATE_TIME_ASIS
$calculatedValue
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.
private
mixed
$calculatedValue
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.
$dataType
Type of the cell data.
private
string
$dataType
$formulaAttributes
Attributes of the formula.
private
null|array<string, string>
$formulaAttributes
= null
$ignoredErrors
private
IgnoredErrors
$ignoredErrors
$parent
The collection of cells that this cell belongs to (i.e. The Cell Collection for the parent Worksheet).
private
Cells|null
$parent
$value
Value of the cell.
private
mixed
$value
$valueBinder
Value binder to use.
private
static IValueBinder|null
$valueBinder
= null
$xfIndex
Index to the cellXf reference for the styling of this cell.
private
int
$xfIndex
= 0
Methods
__clone()
Implement PHP __clone to create a deep clone, not just a shallow copy.
public
__clone() : mixed
__construct()
Create a new Cell.
public
__construct(mixed $value, string|null $dataType, Worksheet $worksheet) : mixed
Parameters
- $value : mixed
- $dataType : string|null
- $worksheet : Worksheet
Tags
__toString()
Convert to string.
public
__toString() : string
Return values
stringattach()
public
attach(Cells $parent) : void
Parameters
- $parent : Cells
compareCells()
Compare 2 cells.
public
static compareCells(Cell $a, Cell $b) : int
Parameters
Return values
int —Result of comparison (always -1 or 1, never zero!)
detach()
public
detach() : void
getAppliedStyle()
Get cell style.
public
getAppliedStyle() : Style
Return values
StylegetCalculateDateTimeType()
public
static getCalculateDateTimeType() : int
Return values
intgetCalculatedValue()
Get calculated cell value.
public
getCalculatedValue([bool $resetLog = true ]) : mixed
Parameters
- $resetLog : bool = true
-
Whether the calculation engine logger should be reset or not
Tags
getCalculatedValueString()
Get calculated cell value converted to string.
public
getCalculatedValueString() : string
Return values
stringgetColumn()
Get cell coordinate column.
public
getColumn() : string
Tags
Return values
stringgetCoordinate()
Get cell coordinate.
public
getCoordinate() : string
Tags
Return values
stringgetDataType()
Get cell data type.
public
getDataType() : string
Return values
stringgetDataValidation()
Get Data validation rules.
public
getDataValidation() : DataValidation
Tags
Return values
DataValidationgetFormattedValue()
Get cell value with formatting.
public
getFormattedValue() : string
Return values
stringgetFormulaAttributes()
Get the formula attributes.
public
getFormulaAttributes() : null|array<string, string>
Return values
null|array<string, string>getHyperlink()
Get Hyperlink.
public
getHyperlink() : Hyperlink
Tags
Return values
HyperlinkgetIgnoredErrors()
public
getIgnoredErrors() : IgnoredErrors
Return values
IgnoredErrorsgetMergeRange()
If this cell is in a merge range, then return the range.
public
getMergeRange() : false|string
Return values
false|stringgetOldCalculatedValue()
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.
public
getOldCalculatedValue() : mixed
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.
getParent()
Get cell collection.
public
getParent() : Cells|null
Return values
Cells|nullgetRow()
Get cell coordinate row.
public
getRow() : int
Tags
Return values
intgetStyle()
Get cell style.
public
getStyle() : Style
Return values
StylegetValue()
Get cell value.
public
getValue() : mixed
getValueBinder()
Get value binder to use.
public
static getValueBinder() : IValueBinder
Return values
IValueBindergetValueString()
public
getValueString() : string
Return values
stringgetWorksheet()
Get parent worksheet.
public
getWorksheet() : Worksheet
Tags
Return values
WorksheetgetWorksheetOrNull()
public
getWorksheetOrNull() : Worksheet|null
Return values
Worksheet|nullgetXfIndex()
Get index to cellXf.
public
getXfIndex() : int
Return values
inthasDataValidation()
Does this cell contain Data validation rules?
public
hasDataValidation() : bool
Tags
Return values
boolhasHyperlink()
Does this cell contain a Hyperlink?
public
hasHyperlink() : bool
Tags
Return values
boolhasValidValue()
Does this cell contain valid value?
public
hasValidValue() : bool
Return values
boolisFormula()
Identify if the cell contains a formula.
public
isFormula() : bool
Return values
boolisHiddenOnFormulaBar()
public
isHiddenOnFormulaBar() : bool
Return values
boolisInMergeRange()
Is this cell in a merge range.
public
isInMergeRange() : bool
Return values
boolisInRange()
Is cell in a specific range?
public
isInRange(string $range) : bool
Parameters
- $range : string
-
Cell range (e.g. A1:A1)
Return values
boolisLocked()
public
isLocked() : bool
Return values
boolisMergeRangeValueCell()
Is this cell the master (top left cell) in a merge range (that holds the actual data value).
public
isMergeRangeValueCell() : bool
Return values
boolrebindParent()
Re-bind parent.
public
rebindParent(Worksheet $parent) : self
Parameters
- $parent : Worksheet
Return values
selfsetCalculateDateTimeType()
public
static setCalculateDateTimeType(int $calculateDateTimeType) : void
Parameters
- $calculateDateTimeType : int
Tags
setCalculatedValue()
Set old calculated value (cached).
public
setCalculatedValue(mixed $originalValue[, bool $tryNumeric = true ]) : self
Parameters
- $originalValue : mixed
-
Value
- $tryNumeric : bool = true
Return values
selfsetDataType()
Set cell data type.
public
setDataType(string $dataType) : self
Parameters
- $dataType : string
-
see DataType::TYPE_*
Return values
selfsetDataValidation()
Set Data validation rules.
public
setDataValidation([DataValidation|null $dataValidation = null ]) : self
Parameters
- $dataValidation : DataValidation|null = null
Tags
Return values
selfsetFormulaAttributes()
Set the formula attributes.
public
setFormulaAttributes(mixed $attributes) : $this
Parameters
- $attributes : mixed
-
null|array<string, string>
Return values
$thissetHyperlink()
Set Hyperlink.
public
setHyperlink([Hyperlink|null $hyperlink = null ]) : self
Parameters
- $hyperlink : Hyperlink|null = null
Tags
Return values
selfsetValue()
Set cell value.
public
setValue(mixed $value[, null|IValueBinder $binder = null ]) : self
Sets the value for a cell, automatically determining the datatype using the value binder
Parameters
- $value : mixed
-
Value
- $binder : null|IValueBinder = null
-
Value Binder to override the currently set Value Binder
Tags
Return values
selfsetValueBinder()
Set value binder to use.
public
static setValueBinder(IValueBinder $binder) : void
Parameters
- $binder : IValueBinder
setValueExplicit()
Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder).
public
setValueExplicit(mixed $value[, string $dataType = DataType::TYPE_STRING ]) : self
Parameters
- $value : mixed
-
Value
- $dataType : string = DataType::TYPE_STRING
-
Explicit data type, see DataType::TYPE_* Note that PhpSpreadsheet does not validate that the value and datatype are consistent, in using this method, then it is your responsibility as an end-user developer to validate that the value and the datatype match. If you do mismatch value and datatype, then the value you enter may be changed to match the datatype that you specify.
Tags
Return values
selfsetXfIndex()
Set index to cellXf.
public
setXfIndex(int $indexValue) : self
Parameters
- $indexValue : int
Return values
selfupdateInCollection()
Update the cell into the cell collection.
public
updateInCollection() : self
Tags
Return values
selfupdateIfCellIsTableHeader()
protected
static updateIfCellIsTableHeader(Worksheet|null $workSheet, self $cell, mixed $oldValue, mixed $newValue) : void
Parameters
- $workSheet : Worksheet|null
- $cell : self
- $oldValue : mixed
- $newValue : mixed
convertDateTimeInt()
Convert date, time, or datetime from int to float if desired.
private
convertDateTimeInt(mixed $result) : mixed
Parameters
- $result : mixed