1 | <?php |
||
13 | class Sheet |
||
14 | { |
||
15 | /** |
||
16 | * Contains the <sheetData> section. |
||
17 | * |
||
18 | * @var \SplFileObject |
||
19 | */ |
||
20 | private $sheetData; |
||
21 | |||
22 | /** |
||
23 | * @var RowBuilderInterface |
||
24 | */ |
||
25 | private $rowBuilder; |
||
26 | |||
27 | /** |
||
28 | * Sheet constructor to init SplFileObject and write xml header. |
||
29 | * Optionally supply a cell id like e.g. A2 to add freeze pane. |
||
30 | * It has to be done right away, since everything is immediately |
||
31 | * written to the SplFileObject. |
||
32 | * |
||
33 | * @param RowBuilderInterface $rowBuilder |
||
34 | * @param string|null $freezePaneCellId |
||
35 | */ |
||
36 | 3 | public function __construct(RowBuilderInterface $rowBuilder, $freezePaneCellId = null) |
|
49 | |||
50 | /** |
||
51 | * Instantiate new sheet with default RowBuilder implementation. |
||
52 | * |
||
53 | * @param string|null $freezePaneCellId |
||
54 | * @return Sheet |
||
55 | */ |
||
56 | 3 | public static function fromDefaults($freezePaneCellId = null) |
|
60 | |||
61 | /** |
||
62 | * Add single data row to sheet and add new style, |
||
63 | * if its not an integer. |
||
64 | * |
||
65 | * @param array $dataRow |
||
66 | * @param int|Style $style |
||
67 | */ |
||
68 | 1 | public function addRow(array $dataRow, $style = 0) |
|
76 | |||
77 | /** |
||
78 | * Add multiple data rows to sheet. |
||
79 | * |
||
80 | * @param array $dataRows |
||
81 | * @param int|Style $style |
||
82 | */ |
||
83 | 1 | public function addRows(array $dataRows, $style = 0) |
|
89 | |||
90 | /** |
||
91 | * Add new style and return its id. |
||
92 | * |
||
93 | * @param Style $style |
||
94 | * @return int |
||
95 | */ |
||
96 | 1 | public function addStyle(Style $style) |
|
100 | |||
101 | /** |
||
102 | * Write closing xml tag and return path to sheet file. |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | 2 | public function sheetFilePath() |
|
111 | } |
||
112 |