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