Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

(no description)

File Size: 680 lines (17 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($pValue, $pDataType, Worksheet $pSheet)   X-Ref
Create a new Cell.

param: mixed $pValue
param: string $pDataType

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.

return: string

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

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

param: mixed $pValue Value
return: $this

setValueExplicit($pValue, $pDataType)   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 $pValue Value
param: string $pDataType Explicit data type, see DataType::TYPE_*
return: Cell

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

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

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

param: mixed $pValue Value
return: Cell

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.

return: string

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

param: string $pDataType see DataType::TYPE_*
return: Cell

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

return: bool

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

return: bool

getDataValidation()   X-Ref
Get Data validation rules.

return: DataValidation

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

param: DataValidation $pDataValidation
return: Cell

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

return: bool

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

return: bool

getHyperlink()   X-Ref
Get Hyperlink.

return: Hyperlink

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

param: Hyperlink $pHyperlink
return: Cell

getParent()   X-Ref
Get cell collection.

return: Cells

getWorksheet()   X-Ref
Get parent worksheet.

return: Worksheet

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

return: bool

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

return: bool

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

return: false|string

getStyle()   X-Ref
Get cell style.

return: Style

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

return: Cell

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

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

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.

return: IValueBinder

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.

return: int

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

param: int $pValue
return: Cell

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

param: mixed $pAttributes
return: $this

getFormulaAttributes()   X-Ref
Get the formula attributes.


__toString()   X-Ref
Convert to string.

return: string