| 1 |
<?php |
| 2 |
|
| 3 |
namespace Box\Spout\Reader\XLSX; |
| 4 |
|
| 5 |
use Box\Spout\Reader\SheetInterface; |
| 6 |
|
| 7 |
/** |
| 8 |
* Class Sheet |
| 9 |
* Represents a sheet within a XLSX file |
| 10 |
* |
| 11 |
* @package Box\Spout\Reader\XLSX |
| 12 |
*/ |
| 13 |
class Sheet implements SheetInterface |
| 14 |
{ |
| 15 |
/** @var \Box\Spout\Reader\XLSX\RowIterator To iterate over sheet's rows */ |
| 16 |
protected $rowIterator; |
| 17 |
|
| 18 |
/** @var int Index of the sheet, based on order in the workbook (zero-based) */ |
| 19 |
protected $index; |
| 20 |
|
| 21 |
/** @var string Name of the sheet */ |
| 22 |
protected $name; |
| 23 |
|
| 24 |
/** @var bool Whether the sheet was the active one */ |
| 25 |
protected $isActive; |
| 26 |
|
| 27 |
/** |
| 28 |
* @param string $filePath Path of the XLSX file being read |
| 29 |
* @param string $sheetDataXMLFilePath Path of the sheet data XML file as in [Content_Types].xml |
| 30 |
* @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based) |
| 31 |
* @param string $sheetName Name of the sheet |
| 32 |
* @param bool $isSheetActive Whether the sheet was defined as active |
| 33 |
* @param \Box\Spout\Reader\XLSX\ReaderOptions $options Reader's current options |
| 34 |
* @param Helper\SharedStringsHelper Helper to work with shared strings |
| 35 |
*/ |
| 36 |
public function __construct($filePath, $sheetDataXMLFilePath, $sheetIndex, $sheetName, $isSheetActive, $options, $sharedStringsHelper) |
| 37 |
{ |
| 38 |
$this->rowIterator = new RowIterator($filePath, $sheetDataXMLFilePath, $options, $sharedStringsHelper); |
| 39 |
$this->index = $sheetIndex; |
| 40 |
$this->name = $sheetName; |
| 41 |
$this->isActive = $isSheetActive; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* @api |
| 46 |
* @return \Box\Spout\Reader\XLSX\RowIterator |
| 47 |
*/ |
| 48 |
public function getRowIterator() |
| 49 |
{ |
| 50 |
return $this->rowIterator; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* @api |
| 55 |
* @return int Index of the sheet, based on order in the workbook (zero-based) |
| 56 |
*/ |
| 57 |
public function getIndex() |
| 58 |
{ |
| 59 |
return $this->index; |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* @api |
| 64 |
* @return string Name of the sheet |
| 65 |
*/ |
| 66 |
public function getName() |
| 67 |
{ |
| 68 |
return $this->name; |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* @api |
| 73 |
* @return bool Whether the sheet was defined as active |
| 74 |
*/ |
| 75 |
public function isActive() |
| 76 |
{ |
| 77 |
return $this->isActive; |
| 78 |
} |
| 79 |
} |
| 80 |
|