class 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

Constants

DEFAULT_RANGE

Default range variable constant

@var string

Methods

notifyCacheController()

Send notification to the cache controller

detach()

No description

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

Create a new Cell

getColumn()

Get cell coordinate column

getRow()

Get cell coordinate row

getCoordinate()

Get cell coordinate

getValue()

Get cell value

getFormattedValue()

Get cell value with formatting

setValue(mixed $pValue = null)

Set cell value

setValueExplicit($pValue = null, $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)

getCalculatedValue(boolean $resetLog = true)

Get calculated cell value

setCalculatedValue($pValue = null)

Set old calculated value (cached)

mixed
getOldCalculatedValue()

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.

getDataType()

Get cell data type

setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING)

Set cell data type

isFormula()

Identify if the cell contains a formula

hasDataValidation()

Does this cell contain Data validation rules?

getDataValidation()

Get Data validation rules

setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null)

Set Data validation rules

hasHyperlink()

Does this cell contain a Hyperlink?

getHyperlink()

Get Hyperlink

setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null)

Set Hyperlink

getParent()

Get parent worksheet

getWorksheet()

Get parent worksheet

isInMergeRange()

Is this cell in a merge range

isMergeRangeValueCell()

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

getMergeRange()

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

getStyle()

Get cell style

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

Is cell in a specific range?

static array
coordinateFromString($pCoordinateString = 'A1')

Coordinate from string

static string
absoluteReference($pCoordinateString = 'A1')

Make string row, column or cell coordinate absolute

static string
absoluteCoordinate($pCoordinateString = 'A1')

Make string coordinate absolute

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

Split range into coordinate strings

static string
buildRange($pRange)

Build range from coordinate strings

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

Calculate range boundaries

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

Calculate range dimension

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

Calculate range boundaries

static int
columnIndexFromString($pString = 'A')

Column index from string

static string
stringFromColumnIndex($pColumnIndex)

String from columnindex

static array
extractAllCellReferencesInRange($pRange = 'A1')

Extract all cell references in range

static int
compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b)

Compare 2 cells

getValueBinder()

Get value binder to use

static 
setValueBinder(PHPExcel_Cell_IValueBinder $binder = null)

Set value binder to use

__clone()

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

int
getXfIndex()

Get index to cellXf

setXfIndex(int $pValue)

Set index to cellXf

setFormulaAttributes($pAttributes) deprecated

No description

getFormulaAttributes() deprecated

No description

string
__toString()

Convert to string

Details

at line 105
notifyCacheController()

Send notification to the cache controller

@return void

at line 112
detach()

at line 131
__construct($pValue = null, $pDataType = null, PHPExcel_Worksheet $pSheet = null)

Create a new Cell

@param mixed $pValue

Parameters

$pValue
$pDataType
PHPExcel_Worksheet $pSheet

at line 155
getColumn()

Get cell coordinate column

@return string

at line 165
getRow()

Get cell coordinate row

@return int

at line 175
getCoordinate()

Get cell coordinate

@return string

at line 185
getValue()

Get cell value

@return mixed

at line 195
getFormattedValue()

Get cell value with formatting

@return string

at line 213
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 PHPExcelCell @throws PHPExcelException

at line 229
setValueExplicit($pValue = null, $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
$pDataType

at line 277
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

at line 325
PHPExcel_Cell setCalculatedValue($pValue = null)

Set old calculated value (cached)

@param mixed $pValue Value

Parameters

$pValue

Return Value

PHPExcel_Cell

at line 344
mixed getOldCalculatedValue()

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.

Return Value

mixed

at line 354
getDataType()

Get cell data type

@return string

at line 365
PHPExcel_Cell setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING)

Set cell data type

@param string $pDataType

Parameters

$pDataType

Return Value

PHPExcel_Cell

at line 380
isFormula()

Identify if the cell contains a formula

@return boolean

at line 391
hasDataValidation()

Does this cell contain Data validation rules?

@return boolean

Exceptions

PHPExcel_Exception

at line 406
getDataValidation()

Get Data validation rules

@return PHPExcelCellDataValidation

Exceptions

PHPExcel_Exception

at line 422
PHPExcel_Cell setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null)

Set Data validation rules

@param PHPExcelCellDataValidation $pDataValidation

Parameters

PHPExcel_Cell_DataValidation $pDataValidation

Return Value

PHPExcel_Cell @throws PHPExcel_Exception

Does this cell contain a Hyperlink?

@return boolean

Exceptions

PHPExcel_Exception

Get Hyperlink

@return PHPExcelCellHyperlink

Exceptions

PHPExcel_Exception

Set Hyperlink

@param PHPExcelCellHyperlink $pHyperlink

Parameters

PHPExcel_Cell_Hyperlink $pHyperlink

Return Value

PHPExcel_Cell @throws PHPExcel_Exception

at line 486
getParent()

Get parent worksheet

@return PHPExcelCachedObjectStorageCacheBase

at line 496
getWorksheet()

Get parent worksheet

@return PHPExcel_Worksheet

at line 506
isInMergeRange()

Is this cell in a merge range

@return boolean

at line 516
isMergeRangeValueCell()

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

@return boolean

at line 533
getMergeRange()

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

@return string

at line 548
getStyle()

Get cell style

@return PHPExcel_Style

at line 559
PHPExcel_Cell rebindParent(PHPExcel_Worksheet $parent)

Re-bind parent

@param PHPExcel_Worksheet $parent

Parameters

PHPExcel_Worksheet $parent

Return Value

PHPExcel_Cell

at line 572
boolean isInRange($pRange = 'A1:A1')

Is cell in a specific range?

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

Parameters

$pRange

Return Value

boolean

at line 593
static array coordinateFromString($pCoordinateString = 'A1')

Coordinate from string

@param string $pCoordinateString

Parameters

$pCoordinateString

Return Value

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

at line 614
static string absoluteReference($pCoordinateString = 'A1')

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

Return Value

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

at line 646
static string absoluteCoordinate($pCoordinateString = 'A1')

Make string coordinate absolute

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

Parameters

$pCoordinateString

Return Value

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

at line 677
static array splitRange($pRange = 'A1:A1')

Split range into coordinate strings

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

Parameters

$pRange

Return Value

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

at line 699
static string buildRange($pRange)

Build range from coordinate strings

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

Parameters

$pRange

Return Value

string String representation of $pRange @throws PHPExcel_Exception

at line 724
static array rangeBoundaries($pRange = 'A1:A1')

Calculate range boundaries

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

Parameters

$pRange

Return Value

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

at line 758
static array rangeDimension($pRange = 'A1:A1')

Calculate range dimension

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

Parameters

$pRange

Return Value

array Range dimension (width, height)

at line 773
static array getRangeBoundaries($pRange = 'A1:A1')

Calculate range boundaries

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

Parameters

$pRange

Return Value

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

at line 799
static int columnIndexFromString($pString = 'A')

Column index from string

@param string $pString

Parameters

$pString

Return Value

int Column index (base 1 !!!)

at line 842
static string stringFromColumnIndex($pColumnIndex)

String from columnindex

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

Parameters

$pColumnIndex

Return Value

string

at line 871
static array extractAllCellReferencesInRange($pRange = 'A1')

Extract all cell references in range

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

Parameters

$pRange

Return Value

array Array containing single cell references

at line 935
static int compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b)

Compare 2 cells

Parameters

PHPExcel_Cell $a Cell a
PHPExcel_Cell $b Cell b

Return Value

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

at line 953
static PHPExcel_Cell_IValueBinder getValueBinder()

Get value binder to use

at line 968
static setValueBinder(PHPExcel_Cell_IValueBinder $binder = null)

Set value binder to use

Parameters

PHPExcel_Cell_IValueBinder $binder

Exceptions

PHPExcel_Exception

at line 980
__clone()

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

at line 997
int getXfIndex()

Get index to cellXf

Return Value

int

at line 1008
PHPExcel_Cell setXfIndex(int $pValue)

Set index to cellXf

Parameters

int $pValue

Return Value

PHPExcel_Cell

at line 1018
setFormulaAttributes($pAttributes) deprecated

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

Parameters

$pAttributes

at line 1027
getFormulaAttributes() deprecated

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

at line 1037
string __toString()

Convert to string

Return Value

string