You are here

private function PHPExcel_Worksheet::_createNewCell in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php \PHPExcel_Worksheet::_createNewCell()

Create a new cell at the specified coordinate

Parameters

string $pCoordinate Coordinate of the cell:

Return value

PHPExcel_Cell Cell that was created

2 calls to PHPExcel_Worksheet::_createNewCell()
PHPExcel_Worksheet::getCell in vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php
Get cell at a specific coordinate
PHPExcel_Worksheet::getCellByColumnAndRow in vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php
Get cell at a specific coordinate by using numeric cell coordinates

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php, line 1215

Class

PHPExcel_Worksheet
PHPExcel_Worksheet

Code

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;
}