/**
  * @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;
 }
 /**
  * {@inheritdoc}
  */
 public function seek($position)
 {
     if ($this->worksheet) {
         $this->worksheet->seek($position + 1);
     }
 }
Exemple #3
0
 /**
  * @expectedException PHPExcel_Exception
  */
 public function testSeekOutOfRange()
 {
     $iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4);
     $iterator->seek(1);
 }