1 | <?php |
||
15 | class Sheet |
||
16 | { |
||
17 | /** |
||
18 | * @var CellBuilder |
||
19 | */ |
||
20 | private $cellBuilder; |
||
21 | |||
22 | /** |
||
23 | * @var WidthCalculator |
||
24 | */ |
||
25 | private $widthCalculator; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $useCellAutosizing = false; |
||
31 | |||
32 | /** |
||
33 | * @var int |
||
34 | */ |
||
35 | private $freezePaneId; |
||
36 | |||
37 | /** |
||
38 | * Track next row index. |
||
39 | * |
||
40 | * @var int |
||
41 | */ |
||
42 | private $rowIndex = 1; |
||
43 | |||
44 | /** |
||
45 | * Holds width/column count of the widest row. |
||
46 | * |
||
47 | * @var int |
||
48 | */ |
||
49 | private $maxRowWidth; |
||
50 | |||
51 | /** |
||
52 | * Holds widths of the widest cells for column sizing. |
||
53 | * |
||
54 | * @var array |
||
55 | */ |
||
56 | private $columnWidths; |
||
57 | |||
58 | /** |
||
59 | * Sheet constructor. |
||
60 | */ |
||
61 | 3 | public function __construct() |
|
66 | |||
67 | /** |
||
68 | * Enable cell autosizing (~30% performance hit!). |
||
69 | */ |
||
70 | 2 | public function enableCellAutosizing() |
|
74 | |||
75 | /** |
||
76 | * Disable cell autosizing (default). |
||
77 | */ |
||
78 | public function disableCellAutosizing() |
||
82 | |||
83 | /** |
||
84 | * Return array containing all column widths. |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | 1 | public function getColumnWidths() |
|
92 | |||
93 | /** |
||
94 | * Return cellId for dimensions. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | 1 | public function getDimensionUpperBound() |
|
102 | |||
103 | /** |
||
104 | * Add single row and style to sheet. |
||
105 | * |
||
106 | * @param array $row |
||
107 | * @param Style $style |
||
108 | * |
||
109 | * @return string |
||
110 | */ |
||
111 | 2 | public function addRow(array $row, Style $style) |
|
126 | |||
127 | /** |
||
128 | * @param int $cellId |
||
129 | */ |
||
130 | 1 | public function setFreezePaneId($cellId) |
|
134 | |||
135 | /** |
||
136 | * Track widest row for dimensions xml (e.g. A1:K123). |
||
137 | * |
||
138 | * @param int $rowWidth |
||
139 | */ |
||
140 | 2 | private function updateMaxRowWidth($rowWidth) |
|
146 | |||
147 | /** |
||
148 | * Get xml string for single cell and update cell widths. |
||
149 | * |
||
150 | * @param array $row |
||
151 | * @param Style $style |
||
152 | * @return string |
||
153 | */ |
||
154 | 2 | private function getCellXml(array $row, Style $style) |
|
170 | |||
171 | /** |
||
172 | * Track cell width for column width sizing. |
||
173 | * |
||
174 | * @param mixed $value |
||
175 | * @param int $cellIndex |
||
176 | * @param Style $style |
||
177 | */ |
||
178 | 2 | private function updateColumnWidths($value, $cellIndex, Style $style) |
|
188 | |||
189 | /** |
||
190 | * Return freeze pane xml string for sheezview. |
||
191 | * |
||
192 | * @return string |
||
193 | */ |
||
194 | 2 | public function getFreezePaneXml() |
|
203 | } |
||
204 |