1 | <?php |
||
15 | class Writer |
||
16 | { |
||
17 | /** |
||
18 | * @var SheetFile |
||
19 | */ |
||
20 | private $sheetFile; |
||
21 | |||
22 | /** |
||
23 | * @var Styler |
||
24 | */ |
||
25 | private $styler; |
||
26 | |||
27 | /** |
||
28 | * @var Sheet |
||
29 | */ |
||
30 | private $sheet; |
||
31 | |||
32 | /** |
||
33 | * Writer constructor. |
||
34 | */ |
||
35 | 6 | public function __construct() |
|
39 | |||
40 | /** |
||
41 | * All cells _above_ this cell will be frozen/fixed. |
||
42 | * |
||
43 | * @param int $cellId |
||
44 | */ |
||
45 | 1 | public function setFreezePaneCellId($cellId) |
|
46 | { |
||
47 | 1 | $this->sheet->setFreezePaneCellId($cellId); |
|
48 | 1 | } |
|
49 | |||
50 | /** |
||
51 | * Set fixed column widths per cell (no ranges) and array index |
||
52 | * 0 being the first column. |
||
53 | * If used alongside cell autosizing, these should be set |
||
54 | * after the last row has been added. |
||
55 | * |
||
56 | * @param array $columnWidths |
||
57 | * @throws \InvalidArgumentException |
||
58 | */ |
||
59 | 1 | public function setFixedColumnWidths(array $columnWidths) |
|
63 | |||
64 | /** |
||
65 | * Start recording row specs for column autosizing. |
||
66 | * |
||
67 | * @return Writer |
||
68 | */ |
||
69 | 3 | public function enableCellAutosizing() |
|
74 | |||
75 | /** |
||
76 | * Stop recording row specs for column autosizing. |
||
77 | * |
||
78 | * @return Writer |
||
79 | */ |
||
80 | 1 | public function disableCellAutosizing() |
|
85 | |||
86 | /** |
||
87 | * Initialize writer defaults. |
||
88 | */ |
||
89 | 6 | private function initialize() |
|
96 | |||
97 | /** |
||
98 | * @param array $rows |
||
99 | * @param Style $style |
||
100 | * @throws \InvalidArgumentException |
||
101 | */ |
||
102 | 2 | public function addRows(array $rows, Style $style = null) |
|
112 | |||
113 | /** |
||
114 | * @param array $row |
||
115 | * @param Style $style |
||
116 | */ |
||
117 | 1 | public function addRow(array $row, Style $style = null) |
|
123 | |||
124 | /** |
||
125 | * Wrap things up and write/output xlsx. |
||
126 | * |
||
127 | * @param string $fileName |
||
128 | */ |
||
129 | 1 | public function writeToFile($fileName = 'dummy.xlsx') |
|
134 | } |
||
135 |