Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

(no description)

File Size: 684 lines (19 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.


setValue($value)   X-Ref
Set cell value.

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

param: mixed $value Value
return: $this

setValueExplicit($value, $dataType)   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

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.


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.


__toString()   X-Ref
Convert to string.

return: string