Create a new cell at the specified coordinate

@param string $pCoordinate    Coordinate of the cell
@return PHPExcel_Cell Cell that was created
166
private function _createNewCell($pCoordinate)
	{
		$cell = $this->_cellCollection->addCacheData(
			$pCoordinate,
			new PHPExcel_Cell(
				NULL, 
				PHPExcel_Cell_DataType::TYPE_NULL, 
				$this
			)
		);
        $this->_cellCollectionIsSorted = false;

        // Coordinates
        $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);
        if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($aCoordinates[0]))
            $this->_cachedHighestColumn = $aCoordinates[0];
        $this->_cachedHighestRow = max($this->_cachedHighestRow, $aCoordinates[1]);

        // Cell needs appropriate xfIndex from dimensions records
		//    but don't create dimension records if they don't already exist
        $rowDimension    = $this->getRowDimension($aCoordinates[1], FALSE);
        $columnDimension = $this->getColumnDimension($aCoordinates[0], FALSE);

        if ($rowDimension !== NULL && $rowDimension->getXfIndex() > 0) {
            // then there is a row dimension with explicit style, assign it to the cell
            $cell->setXfIndex($rowDimension->getXfIndex());
        } elseif ($columnDimension !== NULL && $columnDimension->getXfIndex() > 0) {
            // then there is a column dimension, assign it to the cell
            $cell->setXfIndex($columnDimension->getXfIndex());
        }

        return $cell;
	}
1053596
public function getCacheData($pCoord) {
        if ($pCoord === $this->_currentObjectID) {
            return $this->_currentObject;
        }
        $this->_storeData();

        //    Check if the entry that has been requested actually exists
        if (parent::isDataSet($pCoord)) {
            $obj = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
            if ($obj === FALSE) {
                //    Entry no longer exists in APC, so clear it from the cache array
                parent::deleteCacheData($pCoord);
                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
            }
        } else {
            //    Return null if requested entry doesn't exist in cache
            return null;
        }

        //    Set current entry to the requested entry
        $this->_currentObjectID = $pCoord;
        $this->_currentObject = unserialize($obj);
        //    Re-attach this as the cell's parent
        $this->_currentObject->attach($this);

        //    Return requested entry
        return $this->_currentObject;
    }
1336964
private static function createCoordinates($latitude, $longitude)
    {
        if (null === $latitude || null === $longitude) {
            return null;
        }

        return new Coordinates($latitude, $longitude);
    }
1091436
public function create()
    {
        /**
         * @var Location $location
         */
        $classNamespace = $this->getEntityNamespace();
        $location = new $classNamespace();
        $location
            ->setChildren(new ArrayCollection())
            ->setParents(new ArrayCollection());

        return $location;
    }
291843
public function getPositionAfter(TablePosition $position, $offset = 1)
    {
        $cellsToMove = $offset;
        $newRow = $position->getRow();
        $newCell = $position->getCell();

        while ($cellsToMove > 0 && $newRow < count($this->rows)) {
            $cellCount = count($this->getRow($newRow)->getCells());

            $cellsLeft = $cellCount - $newCell - 1;

            if ($cellsToMove > $cellsLeft) {
                ++$newRow;
                $cellsToMove -= $cellsLeft - 1;
                $newCell = 0;
            } else {
                $newCell = $newCell + $cellsToMove;
                $cellsToMove -= $cellsLeft;
            }
        }

        if ($newRow >= 0 && $newCell >= 0) {
            return new TablePosition($newRow, $newCell);
        }

        return;
    }
1124189
public function setBreak($pCell = 'A1', $pBreak = PHPExcel_Worksheet::BREAK_NONE)
    {
        // Uppercase coordinate
        $pCell = strtoupper($pCell);

        if ($pCell != '') {
        	if ($pBreak == PHPExcel_Worksheet::BREAK_NONE) {
        		if (isset($this->_breaks[$pCell])) {
	            	unset($this->_breaks[$pCell]);
        		}
        	} else {
	            $this->_breaks[$pCell] = $pBreak;
	        }
        } else {
            throw new PHPExcel_Exception('No cell coordinate specified.');
        }

        return $this;
    }
712256
public function getCellByColumnAndRow($pColumn = 0, $pRow = 1)
    {
        $columnLetter = PHPExcel_Cell::stringFromColumnIndex($pColumn);
        $coordinate = $columnLetter . $pRow;

        if (!$this->_cellCollection->isDataSet($coordinate)) {
            $cell = $this->_cellCollection->addCacheData($coordinate, new PHPExcel_Cell(NULL, PHPExcel_Cell_DataType::TYPE_NULL, $this));
            $this->_cellCollectionIsSorted = false;

            if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < $pColumn)
                $this->_cachedHighestColumn = $columnLetter;

            $this->_cachedHighestRow = max($this->_cachedHighestRow,$pRow);

            return $cell;
        }

        return $this->_cellCollection->getCacheData($coordinate);
    }
173926
public function isDataSet($pCoord) {
		if ($pCoord === $this->_currentObjectID) {
			return true;
		}
		//	Check if the requested entry exists in the cache
		return isset($this->_cellCache[$pCoord]);
	}
169534
public function getCellByColumnAndRow($pColumn = 0, $pRow = 1)
    {
        $columnLetter = PHPExcel_Cell::stringFromColumnIndex($pColumn);
        $coordinate = $columnLetter . $pRow;

        if ($this->_cellCollection->isDataSet($coordinate)) {
            return $this->_cellCollection->getCacheData($coordinate);
        }

		return $this->_createNewCell($coordinate);
    }
599989
public function createCopy(array $srcData, Exercise $copyDestination = null)
    {
        $copyDestination = $this->serializer->deserialize($srcData, $copyDestination, [
            Transfer::NO_FETCH,
            Transfer::PERSIST_TAG,
            Transfer::REFRESH_UUID,
        ]);

        // Persist copy
        $this->om->persist($copyDestination);

        return $copyDestination;
    }
77468
public function deleteCacheData($pCoord)
    {
        if ($pCoord === $this->currentObjectID) {
            $this->currentObject->detach();
            $this->currentObjectID = $this->currentObject = null;
        }

        //    Check if the requested entry exists in the cache
        $query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
        if (!$this->DBHandle->queryExec($query)) {
            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
        }

        $this->currentCellIsDirty = false;
    }
540721
protected function createExcel()
    {
        $this->phpexcel = new \PHPExcel();
        $tableNumber = 0;

        // Loop over all tables in document
        foreach($this->document->getTables() as $table){

            // Handle worksheets
            if ($tableNumber > 0) {
                $this->phpexcel->createSheet();
            }
            $excelWorksheet = $this->phpexcel->setActiveSheetIndex($tableNumber);
            if ($sheetTitle = $table->getAttribute('_excel-name')) {
                $excelWorksheet->setTitle($sheetTitle);
            }

            // Loop over all rows
            $rowNumber = 1;
            foreach($table->getRows() as $row){

                $excelWorksheet->getStyle($rowNumber.':'.$rowNumber)->applyFromArray($this->getRowStylesArray($row));
                $this->setDimensions($excelWorksheet, $excelWorksheet->getRowIterator($rowNumber)->current(), $row);

                // Loop over all cells in row
                $cellNumber = 0;
                foreach($row->getCells() as $cell){
                    $excelCellIndex = \PHPExcel_Cell::stringFromColumnIndex($cellNumber).$rowNumber;
                    
                    // Skip cells withing merge range
                    while ($excelWorksheet->getCell($excelCellIndex)->isInMergeRange()) {
                        $cellNumber++;
                        $excelCellIndex = \PHPExcel_Cell::stringFromColumnIndex($cellNumber).$rowNumber;
                    }
                    
                    // Set value
                    $explicitCellType = $cell->getAttribute('_excel-explicit');
                    if (!$explicitCellType) {
                        $explicitCellType = $row->getAttribute('_excel-explicit');
                    }

                    if ($explicitCellType) {
                        $excelWorksheet->setCellValueExplicit(
                            $excelCellIndex,
                            $this->changeValueEncoding($cell->getValue()),
                            $this->convertStaticPhpExcelConstantsFromStringsToConstants($explicitCellType)
                        );
                    } else {
                        $excelWorksheet->setCellValue(
                            $excelCellIndex,
                            $this->changeValueEncoding($cell->getValue())
                        );
                    }

                    // Merge cells
                    $colspan = $cell->getAttribute('colspan');
                    $rowspan = $cell->getAttribute('rowspan');

                    if ($colspan || $rowspan) {
                        if ($colspan) {$colspan = $colspan - 1;}
                        if ($rowspan) {$rowspan = $rowspan - 1;}
                        $mergeCellsTargetCellIndex = \PHPExcel_Cell::stringFromColumnIndex($cellNumber + $colspan).($rowNumber + $rowspan);
                        $excelWorksheet->mergeCells($excelCellIndex.':'.$mergeCellsTargetCellIndex);
                    }

                    // Set styles
                    $excelWorksheet->getStyle($excelCellIndex)->applyFromArray($this->getCellStylesArray($cell));
                    $this->setDimensions($excelWorksheet, $excelWorksheet->getCell($excelCellIndex), $cell);

                    $cellNumber++;
                }

                $rowNumber++;
            }

            $tableNumber++;
        }

        return $this->phpexcel;
    }
439935
public function calculateFormula($formula, $cellID=NULL, PHPExcel_Cell $pCell = NULL) {
		//	Initialise the logging settings
		$this->formulaError = null;
		$this->_debugLog->clearLog();
		$this->_cyclicReferenceStack->clear();

		//	Disable calculation cacheing because it only applies to cell calculations, not straight formulae
		//	But don't actually flush any cache
		$resetCache = $this->getCalculationCacheEnabled();
		$this->_calculationCacheEnabled = FALSE;
		//	Execute the calculation
		try {
			$result = self::_unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell));
		} catch (PHPExcel_Exception $e) {
			throw new PHPExcel_Calculation_Exception($e->getMessage());
		}

		//	Reset calculation cacheing to its previous state
		$this->_calculationCacheEnabled = $resetCache;

		return $result;
	}
346260
public function isDataSet($pCoord)
    {
        //    Check if the requested entry is the current object, or exists in the cache
        if (parent::isDataSet($pCoord)) {
            if ($this->currentObjectID == $pCoord) {
                return true;
            }
            //    Check if the requested entry still exists in Memcache
            $success = $this->memcache->get($this->cachePrefix.$pCoord.'.cache');
            if ($success === false) {
                //    Entry no longer exists in Memcache, so clear it from the cache array
                parent::deleteCacheData($pCoord);
                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
            }
            return true;
        }
        return false;
    }
80434
public function getCacheData($pCoord) {
		if ($pCoord === $this->_currentObjectID) {
			return $this->_currentObject;
		}
		$this->_storeData();

		//	Check if the entry that has been requested actually exists
		$obj = null;
		if (parent::isDataSet($pCoord)) {
			$success = false;
			$obj = wincache_ucache_get($this->_cachePrefix.$pCoord.'.cache', $success);
			if ($success === false) {
				//	Entry no longer exists in WinCache, so clear it from the cache array
				parent::deleteCacheData($pCoord);
				throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
			}
		} else {
			//	Return null if requested entry doesn't exist in cache
			return null;
		}

		//	Set current entry to the requested entry
		$this->_currentObjectID = $pCoord;
		$this->_currentObject = unserialize($obj);
        //    Re-attach this as the cell's parent
        $this->_currentObject->attach($this);

		//	Return requested entry
		return $this->_currentObject;
	}
1127180
public function calculate(PHPExcel_Cell $pCell = null)
    {
        try {
            return $this->calculateCellValue($pCell);
        } catch (PHPExcel_Exception $e) {
            throw new PHPExcel_Calculation_Exception($e->getMessage());
        }
    }
1320694
public function deleteCacheData($pCoord) {
		if ($pCoord === $this->_currentObjectID) {
			$this->_currentObject->detach();
			$this->_currentObjectID = $this->_currentObject = NULL;
		}

		//	Check if the requested entry exists in the cache
		$this->_deleteQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
		$result = $this->_deleteQuery->execute();
		if ($result === FALSE)
			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());

		$this->_currentCellIsDirty = FALSE;
	}