\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

Type

$value

$value : 

Value of the cell

@var mixed

Type

$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

Type

$parent

$parent : 

Parent worksheet

@var PHPExcel_CachedObjectStorage_CacheBase

Type

$xfIndex

$xfIndex : 

Index to cellXf

@var int

Type

$formulaAttributes

$formulaAttributes : 

Attributes of the formula

Type

Methods

notifyCacheController()

notifyCacheController() 

Send notification to the cache controller

@return void

detach()

detach() 

__construct()

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

Create a new Cell

@param mixed $pValue

Parameters

$pValue
string $pDataType

@param PHPExcel_Worksheet $pSheet @throws PHPExcel_Exception

\PHPExcel_Worksheet $pSheet

getColumn()

getColumn() 

Get cell coordinate column

@return string

getRow()

getRow() 

Get cell coordinate row

@return int

getCoordinate()

getCoordinate() 

Get cell coordinate

@return string

getValue()

getValue() 

Get cell value

@return mixed

getFormattedValue()

getFormattedValue() 

Get cell value with formatting

@return string

setValue()

setValue(mixed  $pValue = null) 

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

setValueExplicit()

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

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

$pValue
string $pDataType

Explicit data type @return PHPExcel_Cell @throws PHPExcel_Exception

getCalculatedValue()

getCalculatedValue(boolean  $resetLog = true) 

Get calculated cell value

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

Parameters

boolean $resetLog

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

setCalculatedValue()

setCalculatedValue(  $pValue = null) : \PHPExcel_Cell

Set old calculated value (cached)

@param mixed $pValue Value

Parameters

$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() 

Get cell data type

@return string

setDataType()

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

Set cell data type

@param string $pDataType

Parameters

$pDataType

Returns

\PHPExcel_Cell

isFormula()

isFormula() 

Identify if the cell contains a formula

@return boolean

hasDataValidation()

hasDataValidation() 

Does this cell contain Data validation rules?

@return boolean

Throws

\PHPExcel_Exception

getDataValidation()

getDataValidation() 

Get Data validation rules

@return PHPExcel_Cell_DataValidation

Throws

\PHPExcel_Exception

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() 

Does this cell contain a Hyperlink?

@return boolean

Throws

\PHPExcel_Exception

getHyperlink()

getHyperlink() 

Get Hyperlink

@return PHPExcel_Cell_Hyperlink

Throws

\PHPExcel_Exception

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() 

Get parent worksheet

@return PHPExcel_CachedObjectStorage_CacheBase

getWorksheet()

getWorksheet() 

Get parent worksheet

@return PHPExcel_Worksheet

isInMergeRange()

isInMergeRange() 

Is this cell in a merge range

@return boolean

isMergeRangeValueCell()

isMergeRangeValueCell() 

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

@return boolean

getMergeRange()

getMergeRange() 

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

@return string

getStyle()

getStyle() 

Get cell style

@return PHPExcel_Style

rebindParent()

rebindParent(\PHPExcel_Worksheet  $parent) : \PHPExcel_Cell

Re-bind parent

@param PHPExcel_Worksheet $parent

Parameters

\PHPExcel_Worksheet $parent

Returns

\PHPExcel_Cell

isInRange()

isInRange(  $pRange = 'A1:A1') : boolean

Is cell in a specific range?

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

Parameters

$pRange

Returns

boolean

coordinateFromString()

coordinateFromString(  $pCoordinateString = 'A1') : array

Coordinate from string

@param string $pCoordinateString

Parameters

$pCoordinateString

Returns

array —

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

absoluteReference()

absoluteReference(  $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

$pCoordinateString

Returns

string —

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

absoluteCoordinate()

absoluteCoordinate(  $pCoordinateString = 'A1') : string

Make string coordinate absolute

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

Parameters

$pCoordinateString

Returns

string —

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

splitRange()

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

Split range into coordinate strings

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

Parameters

$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(  $pRange) : string

Build range from coordinate strings

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

Parameters

$pRange

Returns

string —

String representation of $pRange @throws PHPExcel_Exception

rangeBoundaries()

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

Calculate range boundaries

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

Parameters

$pRange

Returns

array —

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

rangeDimension()

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

Calculate range dimension

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

Parameters

$pRange

Returns

array —

Range dimension (width, height)

getRangeBoundaries()

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

Calculate range boundaries

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

Parameters

$pRange

Returns

array —

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

columnIndexFromString()

columnIndexFromString(  $pString = 'A') : integer

Column index from string

@param string $pString

Parameters

$pString

Returns

integer —

Column index (base 1 !!!)

stringFromColumnIndex()

stringFromColumnIndex(  $pColumnIndex) : string

String from columnindex

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

Parameters

$pColumnIndex

Returns

string

extractAllCellReferencesInRange()

extractAllCellReferencesInRange(  $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

$pRange

Returns

array —

Array containing single cell references

compareCells()

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

Compare 2 cells

Parameters

\PHPExcel_Cell $a

Cell a

\PHPExcel_Cell $b

Cell b

Returns

integer —

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

setValueBinder()

setValueBinder(\PHPExcel_Cell_IValueBinder  $binder = null) 

Set value binder to use

Parameters

\PHPExcel_Cell_IValueBinder $binder

Throws

\PHPExcel_Exception

__clone()

__clone() 

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

getXfIndex()

getXfIndex() : integer

Get index to cellXf

Returns

integer

setXfIndex()

setXfIndex(integer  $pValue) : \PHPExcel_Cell

Set index to cellXf

Parameters

integer $pValue

Returns

\PHPExcel_Cell

setFormulaAttributes()

setFormulaAttributes(  $pAttributes) 

Parameters

$pAttributes

getFormulaAttributes()

getFormulaAttributes() 

__toString()

__toString() : string

Convert to string

Returns

string