You are here

public function PHPExcel_CachedObjectStorage_CacheBase::getHighestColumn in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/CacheBase.php \PHPExcel_CachedObjectStorage_CacheBase::getHighestColumn()

* Get highest worksheet column *

Parameters

string $row Return the highest column for the specified row,: or the highest column of any row if no row number is passed * @return string Highest column name

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/CacheBase.php, line 261

Class

PHPExcel_CachedObjectStorage_CacheBase
PHPExcel_CachedObjectStorage_CacheBase

Code

public function getHighestColumn($row = null) {
  if ($row == null) {
    $colRow = $this
      ->getHighestRowAndColumn();
    return $colRow['column'];
  }
  $columnList = array(
    1,
  );
  foreach ($this
    ->getCellList() as $coord) {
    sscanf($coord, '%[A-Z]%d', $c, $r);
    if ($r != $row) {
      continue;
    }
    $columnList[] = PHPExcel_Cell::columnIndexFromString($c);
  }
  return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1);
}