Esempio n. 1
0
 /**
  * Run PHPExcel garabage collector.
  *
  * @return Worksheet
  */
 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 = Cell::columnIndexFromString($colRow['column']);
     // Loop through column dimensions
     foreach ($this->columnDimensions as $dimension) {
         $highestColumn = max($highestColumn, 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 = Cell::stringFromColumnIndex(--$highestColumn);
     }
     $this->cachedHighestRow = $highestRow;
     // Return
     return $this;
 }