Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]

(no description)

File Size: 808 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: Cell  - X-Ref

updateInCollection()   X-Ref
Update the cell into the cell collection.

return: $this

detach()   X-Ref
No description

attach(Cells $parent)   X-Ref
No description

__construct($value, ?string $dataType, Worksheet $worksheet)   X-Ref
Create a new Cell.

param: mixed $value

getColumn()   X-Ref
Get cell coordinate column.

return: string

getRow()   X-Ref
Get cell coordinate row.

return: int

getCoordinate()   X-Ref
Get cell coordinate.

return: string

getValue()   X-Ref
Get cell value.

return: mixed

getFormattedValue()   X-Ref
Get cell value with formatting.


updateIfCellIsTableHeader(?Worksheet $workSheet, self $cell, $oldValue, $newValue)   X-Ref

param: mixed $oldValue
param: mixed $newValue

setValue($value, ?IValueBinder $binder = null)   X-Ref
Set cell value.

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

param: mixed $value Value
param: null|IValueBinder $binder Value Binder to override the currently set Value Binder
return: $this

setValueExplicit($value, string $dataType = DataType::TYPE_STRING)   X-Ref
Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder).

param: mixed $value Value
param: string $dataType Explicit data type, see DataType::TYPE_*
return: Cell

getCalculateDateTimeType()   X-Ref
No description

setCalculateDateTimeType(int $calculateDateTimeType)   X-Ref
No description

convertDateTimeInt($result)   X-Ref
Convert date, time, or datetime from int to float if desired.

param: mixed $result
return: mixed

getCalculatedValue(bool $resetLog = true)   X-Ref
Get calculated cell value.

param: bool $resetLog Whether the calculation engine logger should be reset or not
return: mixed

setCalculatedValue($originalValue)   X-Ref
Set old calculated value (cached).

param: mixed $originalValue Value

getOldCalculatedValue()   X-Ref
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: mixed

getDataType()   X-Ref
Get cell data type.


setDataType($dataType)   X-Ref
Set cell data type.

param: string $dataType see DataType::TYPE_*

isFormula()   X-Ref
Identify if the cell contains a formula.


hasDataValidation()   X-Ref
Does this cell contain Data validation rules?


getDataValidation()   X-Ref
Get Data validation rules.


setDataValidation(?DataValidation $dataValidation = null)   X-Ref
Set Data validation rules.


hasValidValue()   X-Ref
Does this cell contain valid value?


hasHyperlink()   X-Ref
Does this cell contain a Hyperlink?


getHyperlink()   X-Ref
Get Hyperlink.


setHyperlink(?Hyperlink $hyperlink = null)   X-Ref
Set Hyperlink.


getParent()   X-Ref
Get cell collection.

return: ?Cells

getWorksheet()   X-Ref
Get parent worksheet.


getWorksheetOrNull()   X-Ref
No description

isInMergeRange()   X-Ref
Is this cell in a merge range.


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


getMergeRange()   X-Ref
If this cell is in a merge range, then return the range.

return: false|string

getStyle()   X-Ref
Get cell style.


getAppliedStyle()   X-Ref
Get cell style.


rebindParent(Worksheet $parent)   X-Ref
Re-bind parent.


isInRange(string $range)   X-Ref
Is cell in a specific range?

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

compareCells(self $a, self $b)   X-Ref
Compare 2 cells.

param: Cell $a Cell a
param: Cell $b Cell b
return: int Result of comparison (always -1 or 1, never zero!)

getValueBinder()   X-Ref
Get value binder to use.


setValueBinder(IValueBinder $binder)   X-Ref
Set value binder to use.


__clone()   X-Ref
Implement PHP __clone to create a deep clone, not just a shallow copy.


getXfIndex()   X-Ref
Get index to cellXf.


setXfIndex(int $indexValue)   X-Ref
Set index to cellXf.


setFormulaAttributes($attributes)   X-Ref
Set the formula attributes.

param: mixed $attributes
return: $this

getFormulaAttributes()   X-Ref
Get the formula attributes.

return: mixed

__toString()   X-Ref
Convert to string.

return: string

getIgnoredErrors()   X-Ref
No description