Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

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

(no description)

File Size: 698 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: self

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
param: Worksheet $pSheet

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: Cell

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.

param: Worksheet $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.

param: IValueBinder $binder

__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: Cell

getFormulaAttributes()   X-Ref
Get the formula attributes.


__toString()   X-Ref
Convert to string.

return: string