/** * Run PHPExcel garabage collector. * * @return PHPExcel_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 = 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; }
/** * Run PHPExcel garabage collector. * * @return PHPExcel_Worksheet */ public function garbageCollect() { // Flush cache $this->_cellCollection->getCacheData('A1'); // 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 $this; }