ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Cell Class Reference
+ Collaboration diagram for PHPExcel_Cell:

Public Member Functions

 notifyCacheController ()
 Send notification to the cache controller.
 detach ()
 attach ($parent)
 __construct ($pColumn= 'A', $pRow=1, $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 ($pValue=null)
 Set cell value.
 setValueExplicit ($pValue=null, $pDataType=PHPExcel_Cell_DataType::TYPE_STRING)
 Set cell value (with explicit data type given)
 getCalculatedValue ($resetLog=true)
 Get calculated cell value.
 setCalculatedValue ($pValue=null)
 Set calculated value (used for caching)
 getOldCalculatedValue ()
 Get old calculated value (cached)
 getDataType ()
 Get cell data type.
 setDataType ($pDataType=PHPExcel_Cell_DataType::TYPE_STRING)
 Set cell data type.
 hasDataValidation ()
 Has Data validation?
 getDataValidation ()
 Get Data validation.
 setDataValidation (PHPExcel_Cell_DataValidation $pDataValidation=null)
 Set Data validation.
 hasHyperlink ()
 Has Hyperlink.
 getHyperlink ()
 Get Hyperlink.
 setHyperlink (PHPExcel_Cell_Hyperlink $pHyperlink=null)
 Set Hyperlink.
 getParent ()
 Get parent.
 rebindParent (PHPExcel_Worksheet $parent)
 Re-bind parent.
 isInRange ($pRange= 'A1:A1')
 Is cell in a specific range?
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy.
 getXfIndex ()
 Get index to cellXf.
 setXfIndex ($pValue=0)
 Set index to cellXf.
 setFormulaAttributes ($pAttributes)
 getFormulaAttributes ()

Static Public Member Functions

static coordinateFromString ($pCoordinateString= 'A1')
 Coordinate from string.
static absoluteReference ($pCoordinateString= 'A1')
 Make string row, column or cell coordinate absolute.
static absoluteCoordinate ($pCoordinateString= 'A1')
 Make string coordinate absolute.
static splitRange ($pRange= 'A1:A1')
 Split range into coordinate strings.
static buildRange ($pRange)
 Build range from coordinate strings.
static rangeBoundaries ($pRange= 'A1:A1')
 Calculate range boundaries.
static rangeDimension ($pRange= 'A1:A1')
 Calculate range dimension.
static getRangeBoundaries ($pRange= 'A1:A1')
 Calculate range boundaries.
static columnIndexFromString ($pString= 'A')
 Column index from string.
static stringFromColumnIndex ($pColumnIndex=0)
 String from columnindex.
static extractAllCellReferencesInRange ($pRange= 'A1')
 Extract all cell references in range.
static compareCells (PHPExcel_Cell $a, PHPExcel_Cell $b)
 Compare 2 cells.
static getValueBinder ()
 Get value binder to use.
static setValueBinder (PHPExcel_Cell_IValueBinder $binder=null)
 Set value binder to use.

Private Attributes

 $_column
 $_row
 $_value
 $_calculatedValue = null
 $_dataType
 $_parent
 $_xfIndex
 $_formulaAttributes
 Attributes of the formula.

Static Private Attributes

static $_valueBinder = null

Detailed Description

Definition at line 36 of file Cell.php.

Constructor & Destructor Documentation

PHPExcel_Cell::__construct (   $pColumn = 'A',
  $pRow = 1,
  $pValue = null,
  $pDataType = null,
PHPExcel_Worksheet  $pSheet = null 
)

Create a new Cell.

Parameters
string$pColumn
int$pRow
mixed$pValue
string$pDataType
PHPExcel_Worksheet$pSheet
Exceptions
Exception

Definition at line 130 of file Cell.php.

References PHPExcel_Cell_DataType\TYPE_STRING, and PHPExcel_Cell_DataType\TYPE_STRING2.

{
// Initialise cell coordinate
$this->_column = strtoupper($pColumn);
$this->_row = $pRow;
// Initialise cell value
$this->_value = $pValue;
// Set worksheet
$this->_parent = $pSheet;
// Set datatype?
if ($pDataType !== null) {
$this->_dataType = $pDataType;
} else {
if (!self::getValueBinder()->bindValue($this, $pValue)) {
throw new Exception("Value could not be bound to cell.");
}
}
// set default index to cellXf
$this->_xfIndex = 0;
}

Member Function Documentation

PHPExcel_Cell::__clone ( )

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

Definition at line 813 of file Cell.php.

{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
static PHPExcel_Cell::absoluteCoordinate (   $pCoordinateString = 'A1')
static

Make string coordinate absolute.

Parameters
string$pCoordinateStringe.g. 'A1'
Returns
string Absolute coordinate e.g. '$A$1'
Exceptions
Exception

Definition at line 541 of file Cell.php.

References $row, and coordinateFromString().

Referenced by absoluteReference().

{
if (strpos($pCoordinateString,':') === false && strpos($pCoordinateString,',') === false) {
// Create absolute coordinate
list($column, $row) = PHPExcel_Cell::coordinateFromString($pCoordinateString);
if ($column[0] == '$') $column = substr($column,1);
if ($row[0] == '$') $row = substr($row,1);
return '$' . $column . '$' . $row;
} else {
throw new Exception("Coordinate string should not be a cell range.");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Cell::absoluteReference (   $pCoordinateString = 'A1')
static

Make string row, column or cell coordinate absolute.

Parameters
string$pCoordinateStringe.g. 'A' or '1' or 'A1'
Returns
string Absolute coordinate e.g. '$A' or '$1' or '$A$1'
Exceptions
Exception

Definition at line 519 of file Cell.php.

References absoluteCoordinate().

{
if (strpos($pCoordinateString,':') === false && strpos($pCoordinateString,',') === false) {
// Create absolute coordinate
if (ctype_digit($pCoordinateString)) {
return '$'.$pCoordinateString;
} elseif (ctype_alpha($pCoordinateString)) {
return '$'.strtoupper($pCoordinateString);
}
return self::absoluteCoordinate($pCoordinateString);
} else {
throw new Exception("Coordinate string should not be a cell range.");
}
}

+ Here is the call graph for this function:

PHPExcel_Cell::attach (   $parent)

Definition at line 115 of file Cell.php.

{
$this->_parent = $parent;
}
static PHPExcel_Cell::buildRange (   $pRange)
static

Build range from coordinate strings.

Parameters
array$pRangeArray containg one or more arrays containing one or two coordinate strings
Returns
string String representation of $pRange
Exceptions
Exception

Definition at line 577 of file Cell.php.

Referenced by PHPExcel_ReferenceHelper\_updateCellRange().

{
// Verify range
if (!is_array($pRange) || count($pRange) == 0 || !is_array($pRange[0])) {
throw new Exception('Range does not contain any information.');
}
// Build range
$imploded = array();
$counter = count($pRange);
for ($i = 0; $i < $counter; ++$i) {
$pRange[$i] = implode(':', $pRange[$i]);
}
$imploded = implode(',', $pRange);
return $imploded;
}

+ Here is the caller graph for this function:

static PHPExcel_Cell::columnIndexFromString (   $pString = 'A')
static

Column index from string.

Parameters
string$pString
Returns
int Column index (base 1 !!!)
Exceptions
Exception

Definition at line 666 of file Cell.php.

Referenced by PHPExcel_Writer_Excel5_Worksheet\__construct(), PHPExcel_Writer_HTML\_calculateSpans(), PHPExcel_Reader_Excel2007\_castToFormula(), PHPExcel_Writer_HTML\_generateTableHeader(), PHPExcel_Calculation\_processTokenStack(), PHPExcel_Reader_Excel5\_readBIFF8CellAddressB(), PHPExcel_Reader_Excel5\_readBIFF8CellRangeAddressB(), PHPExcel_ReferenceHelper\_updateSingleCellReference(), PHPExcel_Writer_Excel5_Worksheet\_writeBIFF8CellRangeAddressFixed(), PHPExcel_Writer_Excel2007_Worksheet\_writeBreaks(), PHPExcel_Writer_Excel5_Worksheet\_writeBreaks(), PHPExcel_Writer_Excel2007_Worksheet\_writeCols(), PHPExcel_Writer_Excel2007_Drawing\_writeDrawing(), PHPExcel_Writer_Excel5_Worksheet\_writeMergedCells(), PHPExcel_Writer_Excel5_Workbook\_writeNames(), PHPExcel_Writer_Excel5_Worksheet\_writePanes(), PHPExcel_Writer_Excel5_Worksheet\_writeSelection(), PHPExcel_Writer_Excel2007_Worksheet\_writeSheetData(), PHPExcel_Writer_Excel2007_Worksheet\_writeSheetViews(), PHPExcel_Writer_Excel2007_Comments\_writeVMLComment(), PHPExcel_Style\applyFromArray(), PHPExcel_Writer_HTML\buildCSS(), PHPExcel_Writer_Excel5_Escher\close(), PHPExcel_Writer_Excel5_Worksheet\close(), PHPExcel_Calculation_LookupRef\COLUMN(), compareCells(), PHPExcel_Worksheet\duplicateStyle(), PHPExcel_Worksheet\garbageCollect(), PHPExcel_Writer_HTML\generateSheetData(), PHPExcel_Worksheet\getCell(), PHPExcel_Worksheet\getCellByColumnAndRow(), PHPExcel_Worksheet\getColumnDimension(), PHPExcel_Shared_Excel5\getDistanceX(), PHPExcel_ReferenceHelper\insertNewBefore(), isInRange(), PHPExcel_Reader_OOCalc\loadIntoExisting(), PHPExcel_Reader_Excel2003XML\loadIntoExisting(), PHPExcel_Calculation_LookupRef\OFFSET(), PHPExcel_Shared_Excel5\oneAnchor2twoAnchor(), rangeBoundaries(), PHPExcel_Worksheet\removeColumn(), PHPExcel_Worksheet\shrinkRangeToFit(), PHPExcel_ReferenceHelper\updateFormulaReferences(), and PHPExcel_Worksheet_CellIterator\valid().

{
// It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord()
// and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant
// memory overhead either
static $_columnLookup = array(
'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8, 'I' => 9, 'J' => 10, 'K' => 11, 'L' => 12, 'M' => 13,
'N' => 14, 'O' => 15, 'P' => 16, 'Q' => 17, 'R' => 18, 'S' => 19, 'T' => 20, 'U' => 21, 'V' => 22, 'W' => 23, 'X' => 24, 'Y' => 25, 'Z' => 26,
'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13,
'n' => 14, 'o' => 15, 'p' => 16, 'q' => 17, 'r' => 18, 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, 'w' => 23, 'x' => 24, 'y' => 25, 'z' => 26
);
// We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString
// for improved performance
if (isset($pString{0})) {
if (!isset($pString{1})) {
return $_columnLookup[$pString];
} elseif(!isset($pString{2})) {
return $_columnLookup[$pString{0}] * 26 + $_columnLookup[$pString{1}];
} elseif(!isset($pString{3})) {
return $_columnLookup[$pString{0}] * 676 + $_columnLookup[$pString{1}] * 26 + $_columnLookup[$pString{2}];
}
}
throw new Exception("Column string index can not be " . ((isset($pString{0})) ? "longer than 3 characters" : "empty") . ".");
}

+ Here is the caller graph for this function:

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

Compare 2 cells.

Parameters
PHPExcel_Cell$aCell a
PHPExcel_Cell$aCell b
Returns
int Result of comparison (always -1 or 1, never zero!)

Definition at line 770 of file Cell.php.

References columnIndexFromString().

{
if ($a->_row < $b->_row) {
return -1;
} elseif ($a->_row > $b->_row) {
return 1;
return -1;
} else {
return 1;
}
}

+ Here is the call graph for this function:

static PHPExcel_Cell::coordinateFromString (   $pCoordinateString = 'A1')
static

Coordinate from string.

Parameters
string$pCoordinateString
Returns
array Array containing column and row (indexes 0 and 1)
Exceptions
Exception

Definition at line 499 of file Cell.php.

Referenced by PHPExcel_Writer_HTML\_calculateSpans(), PHPExcel_Reader_Excel2007\_castToFormula(), PHPExcel_Calculation\_processTokenStack(), PHPExcel_Reader_Excel5\_readBIFF8CellAddressB(), PHPExcel_Reader_Excel5\_readBIFF8CellRangeAddressB(), PHPExcel_ReferenceHelper\_updateCellRange(), PHPExcel_ReferenceHelper\_updateSingleCellReference(), PHPExcel_Writer_Excel5_Worksheet\_writeBIFF8CellRangeAddressFixed(), PHPExcel_Writer_Excel2007_Worksheet\_writeBreaks(), PHPExcel_Writer_Excel5_Worksheet\_writeBreaks(), PHPExcel_Writer_Excel2007_Drawing\_writeDrawing(), PHPExcel_Writer_Excel5_Worksheet\_writeMergedCells(), PHPExcel_Writer_Excel5_Workbook\_writeNames(), PHPExcel_Writer_Excel5_Worksheet\_writePanes(), PHPExcel_Writer_Excel5_Worksheet\_writeSelection(), PHPExcel_Writer_Excel2007_Worksheet\_writeSheetData(), PHPExcel_Writer_Excel2007_Worksheet\_writeSheetViews(), PHPExcel_Writer_Excel2007_Comments\_writeVMLComment(), absoluteCoordinate(), PHPExcel_Style\applyFromArray(), PHPExcel_Worksheet\cellExists(), PHPExcel_Writer_Excel5_Escher\close(), PHPExcel_Writer_Excel5_Worksheet\close(), PHPExcel_Worksheet\duplicateStyle(), PHPExcel_Calculation\extractNamedRange(), PHPExcel_Worksheet\fromArray(), PHPExcel_Writer_HTML\generateSheetData(), PHPExcel_Worksheet\getCell(), PHPExcel_ReferenceHelper\insertNewBefore(), PHPExcel_Reader_Excel2007\load(), PHPExcel_Reader_Excel5\load(), PHPExcel_Calculation_LookupRef\OFFSET(), PHPExcel_Shared_Excel5\oneAnchor2twoAnchor(), rangeBoundaries(), and PHPExcel_ReferenceHelper\updateFormulaReferences().

{
if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) {
return array($matches[1],$matches[2]);
} elseif ((strpos($pCoordinateString,':') !== false) || (strpos($pCoordinateString,',') !== false)) {
throw new Exception('Cell coordinate string can not be a range of cells.');
} elseif ($pCoordinateString == '') {
throw new Exception('Cell coordinate can not be zero-length string.');
} else {
throw new Exception('Invalid cell coordinate '.$pCoordinateString);
}
}

+ Here is the caller graph for this function:

PHPExcel_Cell::detach ( )

Definition at line 111 of file Cell.php.

{
$this->_parent = null;
}
static PHPExcel_Cell::extractAllCellReferencesInRange (   $pRange = 'A1')
static

Extract all cell references in range.

Parameters
string$pRangeRange (e.g. A1 or A1:A10 or A1:A10 A100:A1000)
Returns
array Array containing single cell references

Definition at line 715 of file Cell.php.

References splitRange().

Referenced by PHPExcel_Reader_Excel5\_readDataValidation(), PHPExcel_Reader_Excel5\_readHyperLink(), PHPExcel_Worksheet\calculateColumnWidths(), PHPExcel_Calculation\extractCellRange(), PHPExcel_Calculation\extractNamedRange(), PHPExcel_Reader_Excel2007\load(), and PHPExcel_Worksheet\mergeCells().

{
// Returnvalue
$returnValue = array();
// Explode spaces
$cellBlocks = explode(' ', str_replace('$', '', strtoupper($pRange)));
foreach ($cellBlocks as $cellBlock) {
// Single cell?
if (strpos($cellBlock,':') === false && strpos($cellBlock,',') === false) {
$returnValue[] = $cellBlock;
continue;
}
// Range...
$ranges = PHPExcel_Cell::splitRange($cellBlock);
foreach($ranges as $range) {
// Single cell?
if (!isset($range[1])) {
$returnValue[] = $range[0];
continue;
}
// Range...
list($rangeStart, $rangeEnd) = $range;
list($startCol, $startRow) = sscanf($rangeStart,'%[A-Z]%d');
list($endCol, $endRow) = sscanf($rangeEnd,'%[A-Z]%d');
$endCol++;
// Current data
$currentCol = $startCol;
$currentRow = $startRow;
// Loop cells
while ($currentCol != $endCol) {
while ($currentRow <= $endRow) {
$returnValue[] = $currentCol.$currentRow;
++$currentRow;
}
++$currentCol;
$currentRow = $startRow;
}
}
}
// Return value
return $returnValue;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Cell::getCalculatedValue (   $resetLog = true)

Get calculated cell value.

Returns
mixed

Definition at line 277 of file Cell.php.

References $_calculatedValue, $_value, getCoordinate(), PHPExcel_Calculation\getInstance(), getParent(), and PHPExcel_Cell_DataType\TYPE_FORMULA.

Referenced by getFormattedValue().

{
// echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().'<br />';
if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) {
try {
// echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value<br />';
$result = PHPExcel_Calculation::getInstance()->calculateCellValue($this,$resetLog);
// echo $this->getCoordinate().' calculation result is '.$result.'<br />';
} catch ( Exception $ex ) {
// echo 'Calculation Exception: '.$ex->getMessage().'<br />';
$result = '#N/A';
throw(new Exception($this->getParent()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage()));
}
if ($result === '#Not Yet Implemented') {
// echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'<br />';
return $this->_calculatedValue; // Fallback if calculation engine does not support the formula.
}
// echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().'<br />';
return $result;
}
// if (is_null($this->_value)) {
// echo 'Cell '.$this->getCoordinate().' has no value, formula or otherwise<br />';
// return null;
// }
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'<br />';
return $this->_value;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Cell::getColumn ( )

Get cell coordinate column.

Returns
string

Definition at line 162 of file Cell.php.

References $_column.

Referenced by isInRange().

{
}

+ Here is the caller graph for this function:

PHPExcel_Cell::getCoordinate ( )

Get cell coordinate.

Returns
string

Definition at line 182 of file Cell.php.

References $_row.

Referenced by PHPExcel_Cell_AdvancedValueBinder\bindValue(), getCalculatedValue(), getDataValidation(), getHyperlink(), hasDataValidation(), hasHyperlink(), PHPExcel_Shared_Date\isDateTime(), setDataValidation(), setHyperlink(), and PHPExcel_CachedObjectStorage_CacheBase\updateCacheData().

{
return $this->_column . $this->_row;
}

+ Here is the caller graph for this function:

PHPExcel_Cell::getDataType ( )

Get cell data type.

Returns
string

Definition at line 337 of file Cell.php.

References $_dataType.

{
}
PHPExcel_Cell::getDataValidation ( )

Get Data validation.

Returns
PHPExcel_Cell_DataValidation

Definition at line 377 of file Cell.php.

References getCoordinate().

{
if (!isset($this->_parent)) {
throw new Exception('Cannot get data validation for cell that is not bound to a worksheet');
}
return $this->_parent->getDataValidation($this->getCoordinate());
}

+ Here is the call graph for this function:

PHPExcel_Cell::getFormattedValue ( )

Get cell value with formatting.

Returns
string

Definition at line 202 of file Cell.php.

References getCalculatedValue(), getXfIndex(), and PHPExcel_Style_NumberFormat\toFormattedString().

{
$this->_parent->getParent()->getCellXfByIndex($this->getXfIndex())->getNumberFormat()->getFormatCode()
);
}

+ Here is the call graph for this function:

PHPExcel_Cell::getFormulaAttributes ( )

Definition at line 854 of file Cell.php.

References $_formulaAttributes.

PHPExcel_Cell::getHyperlink ( )

Get Hyperlink.

Exceptions
Exception
Returns
PHPExcel_Cell_Hyperlink

Definition at line 424 of file Cell.php.

References getCoordinate().

{
if (!isset($this->_parent)) {
throw new Exception('Cannot get hyperlink for cell that is not bound to a worksheet');
}
return $this->_parent->getHyperlink($this->getCoordinate());
}

+ Here is the call graph for this function:

PHPExcel_Cell::getOldCalculatedValue ( )

Get old calculated value (cached)

Returns
mixed

Definition at line 327 of file Cell.php.

References $_calculatedValue.

PHPExcel_Cell::getParent ( )

Get parent.

Returns
PHPExcel_Worksheet

Definition at line 456 of file Cell.php.

References $_parent.

Referenced by PHPExcel_Cell_AdvancedValueBinder\bindValue(), getCalculatedValue(), and PHPExcel_Shared_Date\isDateTime().

{
}

+ Here is the caller graph for this function:

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

Calculate range boundaries.

Parameters
string$pRangeCell range (e.g. A1:A1)
Returns
array Range boundaries (staring Column, starting Row, Final Column, Final Row)

Definition at line 644 of file Cell.php.

Referenced by PHPExcel_Reader_Excel5\_includeCellRangeFiltered(), and PHPExcel_Worksheet\shrinkRangeToFit().

:A1')
{
// Uppercase coordinate
$pRange = strtoupper($pRange);
// Extract range
if (strpos($pRange, ':') === false) {
$rangeA = $rangeB = $pRange;
} else {
list($rangeA, $rangeB) = explode(':', $pRange);
}
return array( self::coordinateFromString($rangeA), self::coordinateFromString($rangeB));
}

+ Here is the caller graph for this function:

PHPExcel_Cell::getRow ( )

Get cell coordinate row.

Returns
int

Definition at line 172 of file Cell.php.

References $_row.

Referenced by isInRange().

{
return $this->_row;
}

+ Here is the caller graph for this function:

PHPExcel_Cell::getValue ( )

Get cell value.

Returns
mixed

Definition at line 192 of file Cell.php.

References $_value.

{
return $this->_value;
}
static PHPExcel_Cell::getValueBinder ( )
static

Get value binder to use.

Returns
PHPExcel_Cell_IValueBinder

Definition at line 788 of file Cell.php.

References $_valueBinder.

{
if (is_null(self::$_valueBinder)) {
self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder();
}
}
PHPExcel_Cell::getXfIndex ( )

Get index to cellXf.

Returns
int

Definition at line 829 of file Cell.php.

References $_xfIndex.

Referenced by getFormattedValue().

{
}

+ Here is the caller graph for this function:

PHPExcel_Cell::hasDataValidation ( )

Has Data validation?

Returns
boolean

Definition at line 363 of file Cell.php.

References getCoordinate().

{
if (!isset($this->_parent)) {
throw new Exception('Cannot check for data validation when cell is not bound to a worksheet');
}
return $this->_parent->dataValidationExists($this->getCoordinate());
}

+ Here is the call graph for this function:

PHPExcel_Cell::hasHyperlink ( )

Has Hyperlink.

Returns
boolean

Definition at line 409 of file Cell.php.

References getCoordinate().

{
if (!isset($this->_parent)) {
throw new Exception('Cannot check for hyperlink when cell is not bound to a worksheet');
}
return $this->_parent->hyperlinkExists($this->getCoordinate());
}

+ Here is the call graph for this function:

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

Is cell in a specific range?

Parameters
string$pRangeCell range (e.g. A1:A1)
Returns
boolean

Definition at line 478 of file Cell.php.

References columnIndexFromString(), getColumn(), getRow(), and rangeBoundaries().

:A1')
{
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange);
// Translate properties
$myColumn = PHPExcel_Cell::columnIndexFromString($this->getColumn());
$myRow = $this->getRow();
// Verify if cell is in range
return (($rangeStart[0] <= $myColumn) && ($rangeEnd[0] >= $myColumn) &&
($rangeStart[1] <= $myRow) && ($rangeEnd[1] >= $myRow)
);
}

+ Here is the call graph for this function:

PHPExcel_Cell::notifyCacheController ( )

Send notification to the cache controller.

Returns
void

Definition at line 106 of file Cell.php.

Referenced by rebindParent(), setCalculatedValue(), setDataType(), setDataValidation(), setHyperlink(), setValueExplicit(), and setXfIndex().

{
$this->_parent->getCellCacheController()->updateCacheData($this);
return $this;
}

+ Here is the caller graph for this function:

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

Calculate range boundaries.

Parameters
string$pRangeCell range (e.g. A1:A1)
Returns
array Range coordinates (Start Cell, End Cell) where Start Cell and End Cell are arrays (Column Number, Row Number)

Definition at line 601 of file Cell.php.

References columnIndexFromString(), and coordinateFromString().

Referenced by isInRange(), rangeDimension(), and PHPExcel_Worksheet\rangeToArray().

:A1')
{
// Uppercase coordinate
$pRange = strtoupper($pRange);
// Extract range
if (strpos($pRange, ':') === false) {
$rangeA = $rangeB = $pRange;
} else {
list($rangeA, $rangeB) = explode(':', $pRange);
}
// Calculate range outer borders
$rangeStart = PHPExcel_Cell::coordinateFromString($rangeA);
$rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB);
// Translate column into index
$rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]);
$rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]);
return array($rangeStart, $rangeEnd);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Calculate range dimension.

Parameters
string$pRangeCell range (e.g. A1:A1)
Returns
array Range dimension (width, height)

Definition at line 630 of file Cell.php.

References rangeBoundaries().

:A1')
{
// Calculate range outer borders
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange);
return array( ($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1) );
}

+ Here is the call graph for this function:

PHPExcel_Cell::rebindParent ( PHPExcel_Worksheet  $parent)

Re-bind parent.

Parameters
PHPExcel_Worksheet$parent
Returns
PHPExcel_Cell

Definition at line 466 of file Cell.php.

References notifyCacheController().

{
$this->_parent = $parent;
return $this->notifyCacheController();
}

+ Here is the call graph for this function:

PHPExcel_Cell::setCalculatedValue (   $pValue = null)

Set calculated value (used for caching)

Parameters
mixed$pValueValue
Returns
PHPExcel_Cell

Definition at line 313 of file Cell.php.

References notifyCacheController().

{
if (!is_null($pValue)) {
$this->_calculatedValue = $pValue;
}
return $this->notifyCacheController();
}

+ Here is the call graph for this function:

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

Set cell data type.

Parameters
string$pDataType
Returns
PHPExcel_Cell

Definition at line 348 of file Cell.php.

References notifyCacheController(), PHPExcel_Cell_DataType\TYPE_STRING, and PHPExcel_Cell_DataType\TYPE_STRING2.

{
$this->_dataType = $pDataType;
return $this->notifyCacheController();
}

+ Here is the call graph for this function:

PHPExcel_Cell::setDataValidation ( PHPExcel_Cell_DataValidation  $pDataValidation = null)

Set Data validation.

Parameters
PHPExcel_Cell_DataValidation$pDataValidation
Exceptions
Exception
Returns
PHPExcel_Cell

Definition at line 393 of file Cell.php.

References getCoordinate(), and notifyCacheController().

{
if (!isset($this->_parent)) {
throw new Exception('Cannot set data validation for cell that is not bound to a worksheet');
}
$this->_parent->setDataValidation($this->getCoordinate(), $pDataValidation);
return $this->notifyCacheController();
}

+ Here is the call graph for this function:

PHPExcel_Cell::setFormulaAttributes (   $pAttributes)

Definition at line 848 of file Cell.php.

{
$this->_formulaAttributes = $pAttributes;
return $this;
}
PHPExcel_Cell::setHyperlink ( PHPExcel_Cell_Hyperlink  $pHyperlink = null)

Set Hyperlink.

Parameters
PHPExcel_Cell_Hyperlink$pHyperlink
Exceptions
Exception
Returns
PHPExcel_Cell

Definition at line 440 of file Cell.php.

References getCoordinate(), and notifyCacheController().

{
if (!isset($this->_parent)) {
throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
}
$this->_parent->setHyperlink($this->getCoordinate(), $pHyperlink);
return $this->notifyCacheController();
}

+ Here is the call graph for this function:

PHPExcel_Cell::setValue (   $pValue = null)

Set cell value.

This clears the cell formula.

Parameters
mixed$pValueValue
Returns
PHPExcel_Cell

Definition at line 217 of file Cell.php.

{
if (!self::getValueBinder()->bindValue($this, $pValue)) {
throw new Exception("Value could not be bound to cell.");
}
return $this;
}
static PHPExcel_Cell::setValueBinder ( PHPExcel_Cell_IValueBinder  $binder = null)
static

Set value binder to use.

Parameters
PHPExcel_Cell_IValueBinder$binder
Exceptions
Exception

Definition at line 802 of file Cell.php.

{
if (is_null($binder)) {
throw new Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
}
self::$_valueBinder = $binder;
}
PHPExcel_Cell::setValueExplicit (   $pValue = null,
  $pDataType = PHPExcel_Cell_DataType::TYPE_STRING 
)

Set cell value (with explicit data type given)

Parameters
mixed$pValueValue
string$pDataTypeExplicit data type
Returns
PHPExcel_Cell
Exceptions
Exception

Definition at line 233 of file Cell.php.

References PHPExcel_Cell_DataType\checkErrorCode(), PHPExcel_Cell_DataType\checkString(), notifyCacheController(), PHPExcel_Cell_DataType\TYPE_BOOL, PHPExcel_Cell_DataType\TYPE_ERROR, PHPExcel_Cell_DataType\TYPE_FORMULA, PHPExcel_Cell_DataType\TYPE_INLINE, PHPExcel_Cell_DataType\TYPE_NULL, PHPExcel_Cell_DataType\TYPE_NUMERIC, PHPExcel_Cell_DataType\TYPE_STRING, and PHPExcel_Cell_DataType\TYPE_STRING2.

Referenced by PHPExcel_Cell_AdvancedValueBinder\bindValue(), and PHPExcel_Cell_DefaultValueBinder\bindValue().

{
// set the value according to data type
switch ($pDataType) {
$this->_value = PHPExcel_Cell_DataType::checkString($pValue);
break;
$this->_value = (float)$pValue;
break;
$this->_value = (string)$pValue;
break;
$this->_value = (bool)$pValue;
break;
$this->_value = PHPExcel_Cell_DataType::checkErrorCode($pValue);
break;
default:
throw new Exception('Invalid datatype: ' . $pDataType);
break;
}
// set the datatype
$this->_dataType = $pDataType;
return $this->notifyCacheController();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Cell::setXfIndex (   $pValue = 0)

Set index to cellXf.

Parameters
int$pValue
Returns
PHPExcel_Cell

Definition at line 840 of file Cell.php.

References notifyCacheController().

{
$this->_xfIndex = $pValue;
return $this->notifyCacheController();
}

+ Here is the call graph for this function:

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

Split range into coordinate strings.

Parameters
string$pRange
Returns
array Array containg one or more arrays containing one or two coordinate strings

Definition at line 560 of file Cell.php.

Referenced by PHPExcel_Writer_HTML\_calculateSpans(), PHPExcel_ReferenceHelper\_updateCellRange(), PHPExcel_Writer_Excel5_Workbook\_writeAllDefinedNamesBiff8(), PHPExcel_Writer_Excel2007_Workbook\_writeDefinedNameForNamedRange(), PHPExcel_Writer_Excel5_Worksheet\_writeMergedCells(), PHPExcel_Writer_Excel5_Workbook\_writeNames(), PHPExcel_Writer_Excel5_Worksheet\_writeSelection(), extractAllCellReferencesInRange(), PHPExcel_Calculation\extractNamedRange(), and PHPExcel_Worksheet\setSelectedCells().

:A1')
{
$exploded = explode(',', $pRange);
$counter = count($exploded);
for ($i = 0; $i < $counter; ++$i) {
$exploded[$i] = explode(':', $exploded[$i]);
}
return $exploded;
}

+ Here is the caller graph for this function:

static PHPExcel_Cell::stringFromColumnIndex (   $pColumnIndex = 0)
static

String from columnindex.

Parameters
int$pColumnIndexColumn index (base 0 !!!)
Returns
string

Definition at line 698 of file Cell.php.

Referenced by PHPExcel_Writer_HTML\_generateRow(), PHPExcel_Writer_Excel5_Worksheet\_positionImage(), PHPExcel_Calculation\_processTokenStack(), PHPExcel_Reader_Excel5\_readBIFF5CellRangeAddressFixed(), PHPExcel_Reader_Excel5\_readBIFF8CellAddress(), PHPExcel_Reader_Excel5\_readBIFF8CellAddressB(), PHPExcel_Reader_Excel5\_readBIFF8CellRangeAddress(), PHPExcel_Reader_Excel5\_readBIFF8CellRangeAddressB(), PHPExcel_Reader_Excel5\_readBIFF8CellRangeAddressFixed(), PHPExcel_Reader_Excel5\_readBlank(), PHPExcel_Reader_Excel5\_readBoolErr(), PHPExcel_Reader_Excel5_Escher\_readClientAnchor(), PHPExcel_Reader_Excel5\_readFormula(), PHPExcel_Reader_Excel5\_readLabel(), PHPExcel_Reader_Excel5\_readLabelSst(), PHPExcel_Reader_Excel5\_readMulBlank(), PHPExcel_Reader_Excel5\_readMulRk(), PHPExcel_Reader_Excel5\_readNumber(), PHPExcel_Reader_Excel5\_readPane(), PHPExcel_Reader_Excel5\_readRk(), PHPExcel_ReferenceHelper\_updateSingleCellReference(), PHPExcel_Worksheet_PageSetup\addPrintAreaByColumnAndRow(), PHPExcel_Style\applyFromArray(), PHPExcel_Calculation_LookupRef\CELL_ADDRESS(), PHPExcel_Worksheet\cellExistsByColumnAndRow(), PHPExcel_Writer_Excel5_Worksheet\close(), PHPExcel_Worksheet\duplicateStyle(), PHPExcel_Worksheet\freezePaneByColumnAndRow(), PHPExcel_Worksheet\garbageCollect(), PHPExcel_Worksheet\getCellByColumnAndRow(), PHPExcel_Worksheet\getColumnDimensionByColumn(), PHPExcel_Worksheet\getCommentByColumnAndRow(), PHPExcel_Shared_Excel5\getDistanceX(), PHPExcel_Worksheet\getStyleByColumnAndRow(), PHPExcel_ReferenceHelper\insertNewBefore(), PHPExcel_Worksheet\insertNewColumnBeforeByIndex(), PHPExcel_Reader_Excel2007\load(), PHPExcel_Reader_SYLK\loadIntoExisting(), PHPExcel_Reader_OOCalc\loadIntoExisting(), PHPExcel_Reader_Excel2003XML\loadIntoExisting(), PHPExcel_Worksheet\mergeCellsByColumnAndRow(), PHPExcel_Calculation_LookupRef\OFFSET(), PHPExcel_Shared_Excel5\oneAnchor2twoAnchor(), PHPExcel_Worksheet\protectCellsByColumnAndRow(), PHPExcel_Worksheet\rangeToArray(), PHPExcel_Worksheet\removeColumn(), PHPExcel_Worksheet\removeColumnByIndex(), PHPExcel_Worksheet\setAutoFilterByColumnAndRow(), PHPExcel_Worksheet\setBreakByColumnAndRow(), PHPExcel_Worksheet\setCellValueByColumnAndRow(), PHPExcel_Worksheet\setCellValueExplicitByColumnAndRow(), PHPExcel_Worksheet_PageSetup\setPrintAreaByColumnAndRow(), PHPExcel_Worksheet\setSelectedCellByColumnAndRow(), PHPExcel_Worksheet\shrinkRangeToFit(), PHPExcel_Worksheet\unmergeCellsByColumnAndRow(), and PHPExcel_Worksheet\unprotectCellsByColumnAndRow().

{
// Determine column string
if ($pColumnIndex < 26) {
return chr(65 + $pColumnIndex);
} elseif ($pColumnIndex < 702) {
return chr(64 + ($pColumnIndex / 26)).chr(65 + $pColumnIndex % 26);
}
return chr(64 + (($pColumnIndex - 26) / 676)).chr(65 + ((($pColumnIndex - 26) % 676) / 26)).chr(65 + $pColumnIndex % 26);
}

+ Here is the caller graph for this function:

Field Documentation

PHPExcel_Cell::$_calculatedValue = null
private

Definition at line 71 of file Cell.php.

Referenced by getCalculatedValue(), and getOldCalculatedValue().

PHPExcel_Cell::$_column
private

Definition at line 50 of file Cell.php.

Referenced by getColumn().

PHPExcel_Cell::$_dataType
private

Definition at line 78 of file Cell.php.

Referenced by getDataType().

PHPExcel_Cell::$_formulaAttributes
private

Attributes of the formula.

Definition at line 99 of file Cell.php.

Referenced by getFormulaAttributes().

PHPExcel_Cell::$_parent
private

Definition at line 85 of file Cell.php.

Referenced by getParent().

PHPExcel_Cell::$_row
private

Definition at line 57 of file Cell.php.

Referenced by getCoordinate(), and getRow().

PHPExcel_Cell::$_value
private

Definition at line 64 of file Cell.php.

Referenced by getCalculatedValue(), and getValue().

PHPExcel_Cell::$_valueBinder = null
staticprivate

Definition at line 43 of file Cell.php.

Referenced by getValueBinder().

PHPExcel_Cell::$_xfIndex
private

Definition at line 92 of file Cell.php.

Referenced by getXfIndex().


The documentation for this class was generated from the following file: