PHPExcel classes » \PHPExcel_Cell

PHPExcel_Cell

category | PHPExcel
package | PHPExcel_Cell
copyright | Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

### Methods

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

    __clone()

## Create a new Cell

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

### Parameters

#### $pValue

`mixed`

#### $pDataType

`string`

#### $pSheet

`\PHPExcel_Worksheet`

### Exceptions

`\PHPExcel_Exception` |

## Convert to string

    __toString() : string

### Returns

`string`

## Make string coordinate absolute

    absoluteCoordinate(string $pCoordinateString) : string

Static

### Parameters

#### $pCoordinateString

`string`

e.g. 'A1'

### Exceptions

`\PHPExcel_Exception` |

### Returns

`string`Absolute coordinate e.g. '$A$1'

## Make string row, column or cell coordinate absolute

    absoluteReference(string $pCoordinateString) : string

Static

### Parameters

#### $pCoordinateString

`string`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`string`Absolute coordinate e.g. '$A' or '$1' or '$A$1'

## attach()

    attach(\PHPExcel_CachedObjectStorage_CacheBase $parent)

### Parameters

#### $parent

## Build range from coordinate strings

    buildRange(array $pRange) : string

Static

### Parameters

#### $pRange

`array`

Array containg one or more arrays containing one or two coordinate strings

### Exceptions

`\PHPExcel_Exception` |

### Returns

`string`String representation of $pRange

## Column index from string

    columnIndexFromString(string $pString) : int

Static

### Parameters

#### $pString

`string`

### Returns

`int`Column index (base 1 !!!)

## Compare 2 cells

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

Static

### Parameters

#### $a

`\PHPExcel_Cell`

Cell a

#### $b

`\PHPExcel_Cell`

Cell b

### Returns

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

## Coordinate from string

    coordinateFromString(string $pCoordinateString) : array

Static

### Parameters

#### $pCoordinateString

`string`

### Exceptions

`\PHPExcel_Exception` |

### Returns

`array`Array containing column and row (indexes 0 and 1)

## detach()

    detach()

## Extract all cell references in range

    extractAllCellReferencesInRange(string $pRange) : array

Static

### Parameters

#### $pRange

`string`

Range (e.g. A1 or A1:C10 or A1:E10 A20:E25)

### Returns

`array`Array containing single cell references

## Get calculated cell value

    getCalculatedValue(boolean $resetLog) : mixed

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

### Parameters

#### $resetLog

`boolean`

Whether the calculation engine logger should be reset or not

### Exceptions

`\PHPExcel_Exception` |

### Returns

`mixed`

## Get cell coordinate column

    getColumn() : string

### Returns

`string`

## Get cell coordinate

    getCoordinate() : string

### Returns

`string`

## Get cell data type

    getDataType() : string

### Returns

`string`

## Get Data validation rules

    getDataValidation() : \PHPExcel_Cell_DataValidation

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Cell_DataValidation`

## Get cell value with formatting

    getFormattedValue() : string

### Returns

`string`

## getFormulaAttributes()

    getFormulaAttributes()

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

## Get Hyperlink

    getHyperlink() : \PHPExcel_Cell_Hyperlink

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Cell_Hyperlink`

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

    getOldCalculatedValue() : mixed

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`

## Get parent worksheet

    getParent() : \PHPExcel_CachedObjectStorage_CacheBase

### Returns

`\PHPExcel_CachedObjectStorage_CacheBase`

## Calculate range boundaries

    getRangeBoundaries(string $pRange) : array

Static

### Parameters

#### $pRange

`string`

Cell range (e.g. A1:A1)

### Returns

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

## Get cell coordinate row

    getRow() : int

### Returns

`int`

## Get cell style

    getStyle() : \PHPExcel_Style

### Returns

`\PHPExcel_Style`

## Get cell value

    getValue() : mixed

### Returns

`mixed`

## Get value binder to use

    getValueBinder() : \PHPExcel_Cell_IValueBinder

Static

### Returns

`\PHPExcel_Cell_IValueBinder`

## Get parent worksheet

    getWorksheet() : \PHPExcel_Worksheet

### Returns

`\PHPExcel_Worksheet`

## Get index to cellXf

    getXfIndex() : int

### Returns

`int`

## Does this cell contain Data validation rules?

    hasDataValidation() : boolean

### Exceptions

`\PHPExcel_Exception` |

### Returns

`boolean`

## Does this cell contain a Hyperlink?

    hasHyperlink() : boolean

### Exceptions

`\PHPExcel_Exception` |

### Returns

`boolean`

## Identify if the cell contains a formula

    isFormula()

@return boolean

## Is cell in a specific range?

    isInRange(string $pRange) : boolean

### Parameters

#### $pRange

`string`

Cell range (e.g. A1:A1)

### Returns

`boolean`

## Send notification to the cache controller

    notifyCacheController() : void

## Calculate range boundaries

    rangeBoundaries(string $pRange) : array

Static

### Parameters

#### $pRange

`string`

Cell range (e.g. A1:A1)

### Returns

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

## Calculate range dimension

    rangeDimension(string $pRange) : array

Static

### Parameters

#### $pRange

`string`

Cell range (e.g. A1:A1)

### Returns

`array`Range dimension (width, height)

## Re-bind parent

    rebindParent(\PHPExcel_Worksheet $parent) : \PHPExcel_Cell

### Parameters

#### $parent

`\PHPExcel_Worksheet`

### Returns

`\PHPExcel_Cell`

## Set old calculated value (cached)

    setCalculatedValue(mixed $pValue) : \PHPExcel_Cell

### Parameters

#### $pValue

`mixed`

Value

### Returns

`\PHPExcel_Cell`

## Set cell data type

    setDataType(string $pDataType) : \PHPExcel_Cell

### Parameters

#### $pDataType

`string`

### Returns

`\PHPExcel_Cell`

## Set Data validation rules

    setDataValidation(\PHPExcel_Cell_DataValidation $pDataValidation) : \PHPExcel_Cell

### Parameters

#### $pDataValidation

`\PHPExcel_Cell_DataValidation`

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Cell`

## setFormulaAttributes()

    setFormulaAttributes($pAttributes)

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

### Parameters

#### $pAttributes

## Set Hyperlink

    setHyperlink(\PHPExcel_Cell_Hyperlink $pHyperlink) : \PHPExcel_Cell

### Parameters

#### $pHyperlink

`\PHPExcel_Cell_Hyperlink`

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Cell`

## Set cell value

    setValue(mixed $pValue) : \PHPExcel_Cell

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

### Parameters

#### $pValue

`mixed`

Value

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Cell`

## Set value binder to use

    setValueBinder(\PHPExcel_Cell_IValueBinder $binder)

Static

### Parameters

#### $binder

`\PHPExcel_Cell_IValueBinder`

### Exceptions

`\PHPExcel_Exception` |

## Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder)

    setValueExplicit(mixed $pValue, string $pDataType) : \PHPExcel_Cell

### Parameters

#### $pValue

`mixed`

Value

#### $pDataType

`string`

Explicit data type

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Cell`

## Set index to cellXf

    setXfIndex(int $pValue) : \PHPExcel_Cell

### Parameters

#### $pValue

`int`

### Returns

`\PHPExcel_Cell`

## Split range into coordinate strings

    splitRange(string $pRange) : array

Static

### Parameters

#### $pRange

`string`

e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4'

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

## String from columnindex

    stringFromColumnIndex(int $pColumnIndex) : string

Static

### Parameters

#### $pColumnIndex

`int`

Column index (base 0 !!!)

### Returns

`string`

### Properties

##

    $_calculatedValue : mixed

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.

##

    $_dataType : string

##

    $_formulaAttributes

##

    $_parent : \PHPExcel_CachedObjectStorage_CacheBase

##

    $_value : mixed

##

    $_valueBinder : \PHPExcel_Cell_IValueBinder

##

    $_xfIndex : int

### Constants

## Default range variable constant

    DEFAULT_RANGE

@var string