\PHPExcel_Cell

PHPExcel_Cell

Copyright (c) 2006 - 2015 PHPExcel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Summary

Methods
Properties
Constants
notifyCacheController()
detach()
attach()
__construct()
getColumn()
getRow()
getCoordinate()
getValue()
getFormattedValue()
setValue()
setValueExplicit()
getCalculatedValue()
setCalculatedValue()
getOldCalculatedValue()
getDataType()
setDataType()
isFormula()
hasDataValidation()
getDataValidation()
setDataValidation()
hasHyperlink()
getHyperlink()
setHyperlink()
getParent()
getWorksheet()
isInMergeRange()
isMergeRangeValueCell()
getMergeRange()
getStyle()
rebindParent()
isInRange()
coordinateFromString()
absoluteReference()
absoluteCoordinate()
splitRange()
buildRange()
rangeBoundaries()
rangeDimension()
getRangeBoundaries()
columnIndexFromString()
stringFromColumnIndex()
extractAllCellReferencesInRange()
compareCells()
getValueBinder()
setValueBinder()
__clone()
getXfIndex()
setXfIndex()
setFormulaAttributes()
getFormulaAttributes()
__toString()
No public properties found
DEFAULT_RANGE
No protected methods found
No protected properties found
N/A
No private methods found
$valueBinder
$value
$calculatedValue
$dataType
$parent
$xfIndex
$formulaAttributes
N/A

Constants

DEFAULT_RANGE

DEFAULT_RANGE = 'A1:A1'

Default range variable constant

@var string

Properties

$valueBinder

$valueBinder

Value binder to use

@var PHPExcel_Cell_IValueBinder

$value

$value

Value of the cell

@var mixed

$calculatedValue

$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.

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.

Type

mixed —

$dataType

$dataType

Type of the cell data

@var string

$parent

$parent

Parent worksheet

@var PHPExcel_CachedObjectStorage_CacheBase

$xfIndex

$xfIndex

Index to cellXf

@var int

$formulaAttributes

$formulaAttributes

Attributes of the formula

Methods

notifyCacheController()

notifyCacheController() : mixed

Send notification to the cache controller

@return void

Returns

mixed —

detach()

detach() : mixed

Returns

mixed —

attach()

attach(\PHPExcel_CachedObjectStorage_CacheBase  $parent) : mixed

Parameters

\PHPExcel_CachedObjectStorage_CacheBase $parent

Returns

mixed —

__construct()

__construct(mixed  $pValue = null, string  $pDataType = null, \PHPExcel_Worksheet  $pSheet = null) : mixed

Create a new Cell

@param mixed $pValue

Parameters

mixed $pValue
string $pDataType

@param PHPExcel_Worksheet $pSheet @throws PHPExcel_Exception

\PHPExcel_Worksheet $pSheet

Returns

mixed —

getColumn()

getColumn() : mixed

Get cell coordinate column

@return string

Returns

mixed —

getRow()

getRow() : mixed

Get cell coordinate row

@return int

Returns

mixed —

getCoordinate()

getCoordinate() : mixed

Get cell coordinate

@return string

Returns

mixed —

getValue()

getValue() : mixed

Get cell value

@return mixed

Returns

mixed —

getFormattedValue()

getFormattedValue() : mixed

Get cell value with formatting

@return string

Returns

mixed —

setValue()

setValue(mixed  $pValue = null) : mixed

Set cell value

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

Parameters

mixed $pValue

Value @return PHPExcel_Cell @throws PHPExcel_Exception

Returns

mixed —

setValueExplicit()

setValueExplicit(mixed  $pValue = null, string  $pDataType = PHPExcel_Cell_DataType::TYPE_STRING) : mixed

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

Parameters

mixed $pValue
string $pDataType

Explicit data type @return PHPExcel_Cell @throws PHPExcel_Exception

Returns

mixed —

getCalculatedValue()

getCalculatedValue(bool  $resetLog = true) : mixed

Get calculated cell value

@deprecated Since version 1.7.8 for planned changes to cell for array formula handling

Parameters

bool $resetLog

Whether the calculation engine logger should be reset or not @return mixed @throws PHPExcel_Exception

Returns

mixed —

setCalculatedValue()

setCalculatedValue(mixed  $pValue = null) : \PHPExcel_Cell

Set old calculated value (cached)

@param mixed $pValue Value

Parameters

mixed $pValue

Returns

\PHPExcel_Cell —

getOldCalculatedValue()

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.

Note that this value is not guaranteed to refelect 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.

Returns

mixed —

getDataType()

getDataType() : mixed

Get cell data type

@return string

Returns

mixed —

setDataType()

setDataType(mixed  $pDataType = PHPExcel_Cell_DataType::TYPE_STRING) : \PHPExcel_Cell

Set cell data type

@param string $pDataType

Parameters

mixed $pDataType

Returns

\PHPExcel_Cell —

isFormula()

isFormula() : mixed

Identify if the cell contains a formula

@return boolean

Returns

mixed —

hasDataValidation()

hasDataValidation() : mixed

Does this cell contain Data validation rules?

@return boolean

Throws

\PHPExcel_Exception

Returns

mixed —

getDataValidation()

getDataValidation() : mixed

Get Data validation rules

@return PHPExcel_Cell_DataValidation

Throws

\PHPExcel_Exception

Returns

mixed —

setDataValidation()

setDataValidation(\PHPExcel_Cell_DataValidation  $pDataValidation = null) : \PHPExcel_Cell

Set Data validation rules

@param PHPExcel_Cell_DataValidation $pDataValidation

Parameters

\PHPExcel_Cell_DataValidation $pDataValidation

Returns

\PHPExcel_Cell —

@throws PHPExcel_Exception

hasHyperlink()

hasHyperlink() : mixed

Does this cell contain a Hyperlink?

@return boolean

Throws

\PHPExcel_Exception

Returns

mixed —

getHyperlink()

getHyperlink() : mixed

Get Hyperlink

@return PHPExcel_Cell_Hyperlink

Throws

\PHPExcel_Exception

Returns

mixed —

setHyperlink()

setHyperlink(\PHPExcel_Cell_Hyperlink  $pHyperlink = null) : \PHPExcel_Cell

Set Hyperlink

@param PHPExcel_Cell_Hyperlink $pHyperlink

Parameters

\PHPExcel_Cell_Hyperlink $pHyperlink

Returns

\PHPExcel_Cell —

@throws PHPExcel_Exception

getParent()

getParent() : mixed

Get parent worksheet

@return PHPExcel_CachedObjectStorage_CacheBase

Returns

mixed —

getWorksheet()

getWorksheet() : mixed

Get parent worksheet

@return PHPExcel_Worksheet

Returns

mixed —

isInMergeRange()

isInMergeRange() : mixed

Is this cell in a merge range

@return boolean

Returns

mixed —

isMergeRangeValueCell()

isMergeRangeValueCell() : mixed

Is this cell the master (top left cell) in a merge range (that holds the actual data value)

@return boolean

Returns

mixed —

getMergeRange()

getMergeRange() : mixed

If this cell is in a merge range, then return the range

@return string

Returns

mixed —

getStyle()

getStyle() : mixed

Get cell style

@return PHPExcel_Style

Returns

mixed —

rebindParent()

rebindParent(\PHPExcel_Worksheet  $parent) : \PHPExcel_Cell

Re-bind parent

@param PHPExcel_Worksheet $parent

Parameters

\PHPExcel_Worksheet $parent

Returns

\PHPExcel_Cell —

isInRange()

isInRange(mixed  $pRange = 'A1:A1') : bool

Is cell in a specific range?

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

Parameters

mixed $pRange

Returns

bool —

coordinateFromString()

coordinateFromString(mixed  $pCoordinateString = 'A1') : array

Coordinate from string

@param string $pCoordinateString

Parameters

mixed $pCoordinateString

Returns

array —

Array containing column and row (indexes 0 and 1) @throws PHPExcel_Exception

absoluteReference()

absoluteReference(mixed  $pCoordinateString = 'A1') : string

Make string row, column or cell coordinate absolute

@param string $pCoordinateString e.g. 'A' or '1' or 'A1' Note that this value can be a row or column reference as well as a cell reference

Parameters

mixed $pCoordinateString

Returns

string —

Absolute coordinate e.g. '$A' or '$1' or '$A$1' @throws PHPExcel_Exception

absoluteCoordinate()

absoluteCoordinate(mixed  $pCoordinateString = 'A1') : string

Make string coordinate absolute

@param string $pCoordinateString e.g. 'A1'

Parameters

mixed $pCoordinateString

Returns

string —

Absolute coordinate e.g. '$A$1' @throws PHPExcel_Exception

splitRange()

splitRange(mixed  $pRange = 'A1:A1') : array

Split range into coordinate strings

@param string $pRange e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4'

Parameters

mixed $pRange

Returns

array —

Array containg one or more arrays containing one or two coordinate strings e.g. array('B4','D9') or array(array('B4','D9'),array('H2','O11')) or array('B4')

buildRange()

buildRange(mixed  $pRange) : string

Build range from coordinate strings

@param array $pRange Array containg one or more arrays containing one or two coordinate strings

Parameters

mixed $pRange

Returns

string —

String representation of $pRange @throws PHPExcel_Exception

rangeBoundaries()

rangeBoundaries(mixed  $pRange = 'A1:A1') : array

Calculate range boundaries

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

Parameters

mixed $pRange

Returns

array —

Range coordinates array(Start Cell, End Cell) where Start Cell and End Cell are arrays (Column Number, Row Number)

rangeDimension()

rangeDimension(mixed  $pRange = 'A1:A1') : array

Calculate range dimension

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

Parameters

mixed $pRange

Returns

array —

Range dimension (width, height)

getRangeBoundaries()

getRangeBoundaries(mixed  $pRange = 'A1:A1') : array

Calculate range boundaries

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

Parameters

mixed $pRange

Returns

array —

Range coordinates array(Start Cell, End Cell) where Start Cell and End Cell are arrays (Column ID, Row Number)

columnIndexFromString()

columnIndexFromString(mixed  $pString = 'A') : int

Column index from string

@param string $pString

Parameters

mixed $pString

Returns

int —

Column index (base 1 !!!)

stringFromColumnIndex()

stringFromColumnIndex(mixed  $pColumnIndex) : string

String from columnindex

@param int $pColumnIndex Column index (base 0 !!!)

Parameters

mixed $pColumnIndex

Returns

string —

extractAllCellReferencesInRange()

extractAllCellReferencesInRange(mixed  $pRange = 'A1') : array

Extract all cell references in range

@param string $pRange Range (e.g. A1 or A1:C10 or A1:E10 A20:E25)

Parameters

mixed $pRange

Returns

array —

Array containing single cell references

compareCells()

compareCells(\PHPExcel_Cell  $a, \PHPExcel_Cell  $b) : int

Compare 2 cells

Parameters

\PHPExcel_Cell $a

Cell a

\PHPExcel_Cell $b

Cell b

Returns

int —

Result of comparison (always -1 or 1, never zero!)

getValueBinder()

getValueBinder() : \PHPExcel_Cell_IValueBinder

Get value binder to use

Returns

\PHPExcel_Cell_IValueBinder —

setValueBinder()

setValueBinder(\PHPExcel_Cell_IValueBinder  $binder = null) : mixed

Set value binder to use

Parameters

\PHPExcel_Cell_IValueBinder $binder

Throws

\PHPExcel_Exception

Returns

mixed —

__clone()

__clone() : mixed

Implement PHP __clone to create a deep clone, not just a shallow copy.

Returns

mixed —

getXfIndex()

getXfIndex() : int

Get index to cellXf

Returns

int —

setXfIndex()

setXfIndex(int  $pValue) : \PHPExcel_Cell

Set index to cellXf

Parameters

int $pValue

Returns

\PHPExcel_Cell —

setFormulaAttributes()

setFormulaAttributes(mixed  $pAttributes) : mixed

Parameters

mixed $pAttributes

Returns

mixed —

getFormulaAttributes()

getFormulaAttributes() : mixed

Returns

mixed —

__toString()

__toString() : string

Convert to string

Returns

string —