Example #1
0
 /**
  * {@inheritdoc}
  */
 public function rewind()
 {
     if ($this->worksheet) {
         if (null === $this->headerRowNumber) {
             $this->worksheet->rewind();
         } else {
             $this->worksheet->seek($this->headerRowNumber + 1);
         }
     }
 }
 /**
  * @param $startRowIndex
  * @return \PHPExcel_Worksheet
  */
 private function reloadIterator($startRowIndex)
 {
     $this->filter->setRows($startRowIndex);
     $phpExcel = $this->reader->load($this->filename);
     $worksheet = $phpExcel->getSheet($this->sheetNumber - 1);
     $this->rowIterator = $worksheet->getRowIterator();
     $this->rowIterator->rewind();
     try {
         $this->rowIterator->seek($startRowIndex);
     } catch (\PHPExcel_Exception $ex) {
         //Edge case: the data source ends right at the end of this chunk, so the new chunk is empty and the seek
         //operation fails. Set the end to -1 to make the iterator invalid from now on
         $this->rowIterator->resetEnd(-1);
     }
     return $worksheet;
 }