You are here

public function PHPExcel_Worksheet::garbageCollect 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::garbageCollect()

Run PHPExcel garabage collector.

Return value

PHPExcel_Worksheet

1 call to PHPExcel_Worksheet::garbageCollect()
PHPExcel_Worksheet::toArray in vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php
Create array from worksheet

File

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

Class

PHPExcel_Worksheet
PHPExcel_Worksheet

Code

public function garbageCollect() {

  // Flush cache
  $this->_cellCollection
    ->getCacheData('A1');

  // Build a reference table from images
  //        $imageCoordinates = array();
  //        $iterator = $this->getDrawingCollection()->getIterator();
  //        while ($iterator->valid()) {
  //            $imageCoordinates[$iterator->current()->getCoordinates()] = true;
  //
  //            $iterator->next();
  //        }
  //
  // Lookup highest column and highest row if cells are cleaned
  $colRow = $this->_cellCollection
    ->getHighestRowAndColumn();
  $highestRow = $colRow['row'];
  $highestColumn = PHPExcel_Cell::columnIndexFromString($colRow['column']);

  // Loop through column dimensions
  foreach ($this->_columnDimensions as $dimension) {
    $highestColumn = max($highestColumn, PHPExcel_Cell::columnIndexFromString($dimension
      ->getColumnIndex()));
  }

  // Loop through row dimensions
  foreach ($this->_rowDimensions as $dimension) {
    $highestRow = max($highestRow, $dimension
      ->getRowIndex());
  }

  // Cache values
  if ($highestColumn < 0) {
    $this->_cachedHighestColumn = 'A';
  }
  else {
    $this->_cachedHighestColumn = PHPExcel_Cell::stringFromColumnIndex(--$highestColumn);
  }
  $this->_cachedHighestRow = $highestRow;

  // Return
  return $this;
}