Ejemplo n.º 1
0
 /**
  * @param PHPExcel_Worksheet $sheet
  *
  * @return RowCollection
  */
 public function parse(PHPExcel_Worksheet $sheet)
 {
     // Init row collection
     $collection = new RowCollection();
     // Set the sheet title
     $collection->setTitle($sheet->getTitle());
     // Get the sheet heading row
     $heading = (new HeadingParser($this->settings))->parse($sheet);
     // Row parsers
     $parser = new RowParser($this->settings, $heading);
     foreach ($sheet->getRowIterator($this->getStartRow()) as $index => $row) {
         // Limit the results when needed
         if ($this->hasReachedLimit($index)) {
             break;
         }
         $collection->push($parser->parse($row));
     }
     return $collection;
 }
Ejemplo n.º 2
0
 /**
  * @param SpreadsheetInterface $workbook
  * @param                      $name
  * @param                      $sheetIndex
  *
  * @return RowCollection
  */
 public function parse(SpreadsheetInterface $workbook, $name, $sheetIndex)
 {
     // Init row collection
     $collection = new RowCollection();
     // Set the sheet title
     $collection->setTitle($name);
     // Get the sheet heading row
     $heading = (new HeadingParser($this->settings))->parse($workbook, $sheetIndex);
     // Row parser
     $parser = new RowParser($this->settings, $heading);
     foreach ($workbook->createRowIterator($sheetIndex, $this->settings->getRowIteratorSettings()) as $index => $row) {
         if ($index >= $this->getStartRow()) {
             // Limit the results when needed
             if ($this->hasReachedLimit($index)) {
                 break;
             }
             $collection->push($parser->parse($row));
         }
     }
     return $collection;
 }