Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Worksheet often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Worksheet, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
26 | class Worksheet implements IComparable |
||
27 | { |
||
28 | /* Break types */ |
||
29 | const BREAK_NONE = 0; |
||
30 | const BREAK_ROW = 1; |
||
31 | const BREAK_COLUMN = 2; |
||
32 | |||
33 | /* Sheet state */ |
||
34 | const SHEETSTATE_VISIBLE = 'visible'; |
||
35 | const SHEETSTATE_HIDDEN = 'hidden'; |
||
36 | const SHEETSTATE_VERYHIDDEN = 'veryHidden'; |
||
37 | |||
38 | /** |
||
39 | * Invalid characters in sheet title |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | private static $invalidCharacters = ['*', ':', '/', '\\', '?', '[', ']']; |
||
44 | |||
45 | /** |
||
46 | * Parent spreadsheet |
||
47 | * |
||
48 | * @var Spreadsheet |
||
49 | */ |
||
50 | private $parent; |
||
51 | |||
52 | /** |
||
53 | * Cacheable collection of cells |
||
54 | * |
||
55 | * @var CachedObjectStorage_xxx |
||
56 | */ |
||
57 | private $cellCollection; |
||
58 | |||
59 | /** |
||
60 | * Collection of row dimensions |
||
61 | * |
||
62 | * @var Worksheet\RowDimension[] |
||
63 | */ |
||
64 | private $rowDimensions = []; |
||
65 | |||
66 | /** |
||
67 | * Default row dimension |
||
68 | * |
||
69 | * @var Worksheet\RowDimension |
||
70 | */ |
||
71 | private $defaultRowDimension; |
||
72 | |||
73 | /** |
||
74 | * Collection of column dimensions |
||
75 | * |
||
76 | * @var Worksheet\ColumnDimension[] |
||
77 | */ |
||
78 | private $columnDimensions = []; |
||
79 | |||
80 | /** |
||
81 | * Default column dimension |
||
82 | * |
||
83 | * @var Worksheet\ColumnDimension |
||
84 | */ |
||
85 | private $defaultColumnDimension = null; |
||
86 | |||
87 | /** |
||
88 | * Collection of drawings |
||
89 | * |
||
90 | * @var Worksheet\BaseDrawing[] |
||
91 | */ |
||
92 | private $drawingCollection = null; |
||
93 | |||
94 | /** |
||
95 | * Collection of Chart objects |
||
96 | * |
||
97 | * @var Chart[] |
||
98 | */ |
||
99 | private $chartCollection = []; |
||
100 | |||
101 | /** |
||
102 | * Worksheet title |
||
103 | * |
||
104 | * @var string |
||
105 | */ |
||
106 | private $title; |
||
107 | |||
108 | /** |
||
109 | * Sheet state |
||
110 | * |
||
111 | * @var string |
||
112 | */ |
||
113 | private $sheetState; |
||
114 | |||
115 | /** |
||
116 | * Page setup |
||
117 | * |
||
118 | * @var Worksheet\PageSetup |
||
119 | */ |
||
120 | private $pageSetup; |
||
121 | |||
122 | /** |
||
123 | * Page margins |
||
124 | * |
||
125 | * @var Worksheet\PageMargins |
||
126 | */ |
||
127 | private $pageMargins; |
||
128 | |||
129 | /** |
||
130 | * Page header/footer |
||
131 | * |
||
132 | * @var Worksheet\HeaderFooter |
||
133 | */ |
||
134 | private $headerFooter; |
||
135 | |||
136 | /** |
||
137 | * Sheet view |
||
138 | * |
||
139 | * @var Worksheet\SheetView |
||
140 | */ |
||
141 | private $sheetView; |
||
142 | |||
143 | /** |
||
144 | * Protection |
||
145 | * |
||
146 | * @var Worksheet\Protection |
||
147 | */ |
||
148 | private $protection; |
||
149 | |||
150 | /** |
||
151 | * Collection of styles |
||
152 | * |
||
153 | * @var Style[] |
||
154 | */ |
||
155 | private $styles = []; |
||
156 | |||
157 | /** |
||
158 | * Conditional styles. Indexed by cell coordinate, e.g. 'A1' |
||
159 | * |
||
160 | * @var array |
||
161 | */ |
||
162 | private $conditionalStylesCollection = []; |
||
163 | |||
164 | /** |
||
165 | * Is the current cell collection sorted already? |
||
166 | * |
||
167 | * @var bool |
||
168 | */ |
||
169 | private $cellCollectionIsSorted = false; |
||
170 | |||
171 | /** |
||
172 | * Collection of breaks |
||
173 | * |
||
174 | * @var array |
||
175 | */ |
||
176 | private $breaks = []; |
||
177 | |||
178 | /** |
||
179 | * Collection of merged cell ranges |
||
180 | * |
||
181 | * @var array |
||
182 | */ |
||
183 | private $mergeCells = []; |
||
184 | |||
185 | /** |
||
186 | * Collection of protected cell ranges |
||
187 | * |
||
188 | * @var array |
||
189 | */ |
||
190 | private $protectedCells = []; |
||
191 | |||
192 | /** |
||
193 | * Autofilter Range and selection |
||
194 | * |
||
195 | * @var Worksheet\AutoFilter |
||
196 | */ |
||
197 | private $autoFilter; |
||
198 | |||
199 | /** |
||
200 | * Freeze pane |
||
201 | * |
||
202 | * @var string |
||
203 | */ |
||
204 | private $freezePane = ''; |
||
205 | |||
206 | /** |
||
207 | * Show gridlines? |
||
208 | * |
||
209 | * @var bool |
||
210 | */ |
||
211 | private $showGridlines = true; |
||
212 | |||
213 | /** |
||
214 | * Print gridlines? |
||
215 | * |
||
216 | * @var bool |
||
217 | */ |
||
218 | private $printGridlines = false; |
||
219 | |||
220 | /** |
||
221 | * Show row and column headers? |
||
222 | * |
||
223 | * @var bool |
||
224 | */ |
||
225 | private $showRowColHeaders = true; |
||
226 | |||
227 | /** |
||
228 | * Show summary below? (Row/Column outline) |
||
229 | * |
||
230 | * @var bool |
||
231 | */ |
||
232 | private $showSummaryBelow = true; |
||
233 | |||
234 | /** |
||
235 | * Show summary right? (Row/Column outline) |
||
236 | * |
||
237 | * @var bool |
||
238 | */ |
||
239 | private $showSummaryRight = true; |
||
240 | |||
241 | /** |
||
242 | * Collection of comments |
||
243 | * |
||
244 | * @var Comment[] |
||
245 | */ |
||
246 | private $comments = []; |
||
247 | |||
248 | /** |
||
249 | * Active cell. (Only one!) |
||
250 | * |
||
251 | * @var string |
||
252 | */ |
||
253 | private $activeCell = 'A1'; |
||
254 | |||
255 | /** |
||
256 | * Selected cells |
||
257 | * |
||
258 | * @var string |
||
259 | */ |
||
260 | private $selectedCells = 'A1'; |
||
261 | |||
262 | /** |
||
263 | * Cached highest column |
||
264 | * |
||
265 | * @var string |
||
266 | */ |
||
267 | private $cachedHighestColumn = 'A'; |
||
268 | |||
269 | /** |
||
270 | * Cached highest row |
||
271 | * |
||
272 | * @var int |
||
273 | */ |
||
274 | private $cachedHighestRow = 1; |
||
275 | |||
276 | /** |
||
277 | * Right-to-left? |
||
278 | * |
||
279 | * @var bool |
||
280 | */ |
||
281 | private $rightToLeft = false; |
||
282 | |||
283 | /** |
||
284 | * Hyperlinks. Indexed by cell coordinate, e.g. 'A1' |
||
285 | * |
||
286 | * @var array |
||
287 | */ |
||
288 | private $hyperlinkCollection = []; |
||
289 | |||
290 | /** |
||
291 | * Data validation objects. Indexed by cell coordinate, e.g. 'A1' |
||
292 | * |
||
293 | * @var array |
||
294 | */ |
||
295 | private $dataValidationCollection = []; |
||
296 | |||
297 | /** |
||
298 | * Tab color |
||
299 | * |
||
300 | * @var Style\Color |
||
301 | */ |
||
302 | private $tabColor; |
||
303 | |||
304 | /** |
||
305 | * Dirty flag |
||
306 | * |
||
307 | * @var bool |
||
308 | */ |
||
309 | private $dirty = true; |
||
310 | |||
311 | /** |
||
312 | * Hash |
||
313 | * |
||
314 | * @var string |
||
315 | */ |
||
316 | private $hash; |
||
317 | |||
318 | /** |
||
319 | * CodeName |
||
320 | * |
||
321 | * @var string |
||
322 | */ |
||
323 | private $codeName = null; |
||
324 | |||
325 | /** |
||
326 | * Create a new worksheet |
||
327 | * |
||
328 | * @param Spreadsheet $parent |
||
329 | * @param string $pTitle |
||
330 | */ |
||
331 | 70 | public function __construct(Spreadsheet $parent = null, $pTitle = 'Worksheet') |
|
361 | |||
362 | /** |
||
363 | * Disconnect all cells from this Worksheet object, |
||
364 | * typically so that the worksheet object can be unset |
||
365 | */ |
||
366 | 1 | public function disconnectCells() |
|
375 | |||
376 | /** |
||
377 | * Code to execute when this worksheet is unset() |
||
378 | */ |
||
379 | 1 | public function __destruct() |
|
385 | |||
386 | /** |
||
387 | * Return the cache controller for the cell collection |
||
388 | * |
||
389 | * @return CachedObjectStorage_xxx |
||
390 | */ |
||
391 | 62 | public function getCellCacheController() |
|
395 | |||
396 | /** |
||
397 | * Get array of invalid characters for sheet title |
||
398 | * |
||
399 | * @return array |
||
400 | */ |
||
401 | public static function getInvalidCharacters() |
||
405 | |||
406 | /** |
||
407 | * Check sheet code name for valid Excel syntax |
||
408 | * |
||
409 | * @param string $pValue The string to check |
||
410 | * @throws Exception |
||
411 | * @return string The valid string |
||
412 | */ |
||
413 | 70 | private static function checkSheetCodeName($pValue) |
|
433 | |||
434 | /** |
||
435 | * Check sheet title for valid Excel syntax |
||
436 | * |
||
437 | * @param string $pValue The string to check |
||
438 | * @throws Exception |
||
439 | * @return string The valid string |
||
440 | */ |
||
441 | 70 | private static function checkSheetTitle($pValue) |
|
455 | |||
456 | /** |
||
457 | * Get collection of cells |
||
458 | * |
||
459 | * @param bool $pSorted Also sort the cell collection? |
||
460 | * @return Cell[] |
||
461 | */ |
||
462 | 60 | public function getCellCollection($pSorted = true) |
|
474 | |||
475 | /** |
||
476 | * Sort collection of cells |
||
477 | * |
||
478 | * @return Worksheet |
||
479 | */ |
||
480 | 60 | public function sortCellCollection() |
|
488 | |||
489 | /** |
||
490 | * Get collection of row dimensions |
||
491 | * |
||
492 | * @return Worksheet\RowDimension[] |
||
493 | */ |
||
494 | 59 | public function getRowDimensions() |
|
498 | |||
499 | /** |
||
500 | * Get default row dimension |
||
501 | * |
||
502 | * @return Worksheet\RowDimension |
||
503 | */ |
||
504 | 59 | public function getDefaultRowDimension() |
|
508 | |||
509 | /** |
||
510 | * Get collection of column dimensions |
||
511 | * |
||
512 | * @return Worksheet\ColumnDimension[] |
||
513 | */ |
||
514 | 59 | public function getColumnDimensions() |
|
518 | |||
519 | /** |
||
520 | * Get default column dimension |
||
521 | * |
||
522 | * @return Worksheet\ColumnDimension |
||
523 | */ |
||
524 | 58 | public function getDefaultColumnDimension() |
|
528 | |||
529 | /** |
||
530 | * Get collection of drawings |
||
531 | * |
||
532 | * @return Worksheet\BaseDrawing[] |
||
533 | */ |
||
534 | 59 | public function getDrawingCollection() |
|
538 | |||
539 | /** |
||
540 | * Get collection of charts |
||
541 | * |
||
542 | * @return Chart[] |
||
543 | */ |
||
544 | 14 | public function getChartCollection() |
|
548 | |||
549 | /** |
||
550 | * Add chart |
||
551 | * |
||
552 | * @param Chart $pChart |
||
553 | * @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last) |
||
554 | * @return Chart |
||
555 | */ |
||
556 | 14 | public function addChart(Chart $pChart = null, $iChartIndex = null) |
|
568 | |||
569 | /** |
||
570 | * Return the count of charts on this worksheet |
||
571 | * |
||
572 | * @return int The number of charts |
||
573 | */ |
||
574 | 14 | public function getChartCount() |
|
578 | |||
579 | /** |
||
580 | * Get a chart by its index position |
||
581 | * |
||
582 | * @param string $index Chart index position |
||
583 | * @throws Exception |
||
584 | * @return false|Chart |
||
585 | */ |
||
586 | 13 | public function getChartByIndex($index = null) |
|
601 | |||
602 | /** |
||
603 | * Return an array of the names of charts on this worksheet |
||
604 | * |
||
605 | * @throws Exception |
||
606 | * @return string[] The names of charts |
||
607 | */ |
||
608 | 1 | public function getChartNames() |
|
617 | |||
618 | /** |
||
619 | * Get a chart by name |
||
620 | * |
||
621 | * @param string $chartName Chart name |
||
622 | * @throws Exception |
||
623 | * @return false|Chart |
||
624 | */ |
||
625 | 1 | public function getChartByName($chartName = '') |
|
639 | |||
640 | /** |
||
641 | * Refresh column dimensions |
||
642 | * |
||
643 | * @return Worksheet |
||
644 | */ |
||
645 | 12 | public function refreshColumnDimensions() |
|
658 | |||
659 | /** |
||
660 | * Refresh row dimensions |
||
661 | * |
||
662 | * @return Worksheet |
||
663 | */ |
||
664 | 2 | public function refreshRowDimensions() |
|
677 | |||
678 | /** |
||
679 | * Calculate worksheet dimension |
||
680 | * |
||
681 | * @return string String containing the dimension of this worksheet |
||
682 | */ |
||
683 | 58 | public function calculateWorksheetDimension() |
|
688 | |||
689 | /** |
||
690 | * Calculate worksheet data dimension |
||
691 | * |
||
692 | * @return string String containing the dimension of this worksheet that actually contain data |
||
693 | */ |
||
694 | public function calculateWorksheetDataDimension() |
||
699 | |||
700 | /** |
||
701 | * Calculate widths for auto-size columns |
||
702 | * |
||
703 | * @return Worksheet; |
||
704 | */ |
||
705 | 43 | public function calculateColumnWidths() |
|
777 | |||
778 | /** |
||
779 | * Get parent |
||
780 | * |
||
781 | * @return Spreadsheet |
||
782 | */ |
||
783 | 70 | public function getParent() |
|
787 | |||
788 | /** |
||
789 | * Re-bind parent |
||
790 | * |
||
791 | * @param Spreadsheet $parent |
||
792 | * @return Worksheet |
||
793 | */ |
||
794 | 1 | public function rebindParent(Spreadsheet $parent) |
|
810 | |||
811 | /** |
||
812 | * Get title |
||
813 | * |
||
814 | * @return string |
||
815 | */ |
||
816 | 70 | public function getTitle() |
|
820 | |||
821 | /** |
||
822 | * Set title |
||
823 | * |
||
824 | * @param string $pValue String containing the dimension of this worksheet |
||
825 | * @param string $updateFormulaCellReferences boolean Flag indicating whether cell references in formulae should |
||
826 | * be updated to reflect the new sheet name. |
||
827 | * This should be left as the default true, unless you are |
||
828 | * certain that no formula cells on any worksheet contain |
||
829 | * references to this worksheet |
||
830 | * @return Worksheet |
||
831 | */ |
||
832 | 70 | public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true) |
|
889 | |||
890 | /** |
||
891 | * Get sheet state |
||
892 | * |
||
893 | * @return string Sheet state (visible, hidden, veryHidden) |
||
894 | */ |
||
895 | 58 | public function getSheetState() |
|
899 | |||
900 | /** |
||
901 | * Set sheet state |
||
902 | * |
||
903 | * @param string $value Sheet state (visible, hidden, veryHidden) |
||
904 | * @return Worksheet |
||
905 | */ |
||
906 | 70 | public function setSheetState($value = self::SHEETSTATE_VISIBLE) |
|
912 | |||
913 | /** |
||
914 | * Get page setup |
||
915 | * |
||
916 | * @return Worksheet\PageSetup |
||
917 | */ |
||
918 | 59 | public function getPageSetup() |
|
922 | |||
923 | /** |
||
924 | * Set page setup |
||
925 | * |
||
926 | * @param Worksheet\PageSetup $pValue |
||
927 | * @return Worksheet |
||
928 | */ |
||
929 | public function setPageSetup(Worksheet\PageSetup $pValue) |
||
935 | |||
936 | /** |
||
937 | * Get page margins |
||
938 | * |
||
939 | * @return Worksheet\PageMargins |
||
940 | */ |
||
941 | 59 | public function getPageMargins() |
|
945 | |||
946 | /** |
||
947 | * Set page margins |
||
948 | * |
||
949 | * @param Worksheet\PageMargins $pValue |
||
950 | * @return Worksheet |
||
951 | */ |
||
952 | public function setPageMargins(Worksheet\PageMargins $pValue) |
||
958 | |||
959 | /** |
||
960 | * Get page header/footer |
||
961 | * |
||
962 | * @return Worksheet\HeaderFooter |
||
963 | */ |
||
964 | 59 | public function getHeaderFooter() |
|
968 | |||
969 | /** |
||
970 | * Set page header/footer |
||
971 | * |
||
972 | * @param Worksheet\HeaderFooter $pValue |
||
973 | * @return Worksheet |
||
974 | */ |
||
975 | public function setHeaderFooter(Worksheet\HeaderFooter $pValue) |
||
981 | |||
982 | /** |
||
983 | * Get sheet view |
||
984 | * |
||
985 | * @return Worksheet\SheetView |
||
986 | */ |
||
987 | 58 | public function getSheetView() |
|
991 | |||
992 | /** |
||
993 | * Set sheet view |
||
994 | * |
||
995 | * @param Worksheet\SheetView $pValue |
||
996 | * @return Worksheet |
||
997 | */ |
||
998 | public function setSheetView(Worksheet\SheetView $pValue) |
||
1004 | |||
1005 | /** |
||
1006 | * Get Protection |
||
1007 | * |
||
1008 | * @return Worksheet\Protection |
||
1009 | */ |
||
1010 | 59 | public function getProtection() |
|
1014 | |||
1015 | /** |
||
1016 | * Set Protection |
||
1017 | * |
||
1018 | * @param Worksheet\Protection $pValue |
||
1019 | * @return Worksheet |
||
1020 | */ |
||
1021 | public function setProtection(Worksheet\Protection $pValue) |
||
1028 | |||
1029 | /** |
||
1030 | * Get highest worksheet column |
||
1031 | * |
||
1032 | * @param string $row Return the data highest column for the specified row, |
||
1033 | * or the highest column of any row if no row number is passed |
||
1034 | * @return string Highest column name |
||
1035 | */ |
||
1036 | 60 | public function getHighestColumn($row = null) |
|
1044 | |||
1045 | /** |
||
1046 | * Get highest worksheet column that contains data |
||
1047 | * |
||
1048 | * @param string $row Return the highest data column for the specified row, |
||
1049 | * or the highest data column of any row if no row number is passed |
||
1050 | * @return string Highest column name that contains data |
||
1051 | */ |
||
1052 | 10 | public function getHighestDataColumn($row = null) |
|
1056 | |||
1057 | /** |
||
1058 | * Get highest worksheet row |
||
1059 | * |
||
1060 | * @param string $column Return the highest data row for the specified column, |
||
1061 | * or the highest row of any column if no column letter is passed |
||
1062 | * @return int Highest row number |
||
1063 | */ |
||
1064 | 60 | public function getHighestRow($column = null) |
|
1072 | |||
1073 | /** |
||
1074 | * Get highest worksheet row that contains data |
||
1075 | * |
||
1076 | * @param string $column Return the highest data row for the specified column, |
||
1077 | * or the highest data row of any column if no column letter is passed |
||
1078 | * @return string Highest row number that contains data |
||
1079 | */ |
||
1080 | 12 | public function getHighestDataRow($column = null) |
|
1084 | |||
1085 | /** |
||
1086 | * Get highest worksheet column and highest row that have cell records |
||
1087 | * |
||
1088 | * @return array Highest column name and highest row number |
||
1089 | */ |
||
1090 | public function getHighestRowAndColumn() |
||
1094 | |||
1095 | /** |
||
1096 | * Set a cell value |
||
1097 | * |
||
1098 | * @param string $pCoordinate Coordinate of the cell |
||
1099 | * @param mixed $pValue Value of the cell |
||
1100 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1101 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1102 | */ |
||
1103 | 36 | public function setCellValue($pCoordinate = 'A1', $pValue = null, $returnCell = false) |
|
1109 | |||
1110 | /** |
||
1111 | * Set a cell value by using numeric cell coordinates |
||
1112 | * |
||
1113 | * @param int $pColumn Numeric column coordinate of the cell (A = 0) |
||
1114 | * @param int $pRow Numeric row coordinate of the cell |
||
1115 | * @param mixed $pValue Value of the cell |
||
1116 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1117 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1118 | */ |
||
1119 | public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $returnCell = false) |
||
1125 | |||
1126 | /** |
||
1127 | * Set a cell value |
||
1128 | * |
||
1129 | * @param string $pCoordinate Coordinate of the cell |
||
1130 | * @param mixed $pValue Value of the cell |
||
1131 | * @param string $pDataType Explicit data type |
||
1132 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1133 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1134 | */ |
||
1135 | public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = Cell\DataType::TYPE_STRING, $returnCell = false) |
||
1142 | |||
1143 | /** |
||
1144 | * Set a cell value by using numeric cell coordinates |
||
1145 | * |
||
1146 | * @param int $pColumn Numeric column coordinate of the cell |
||
1147 | * @param int $pRow Numeric row coordinate of the cell |
||
1148 | * @param mixed $pValue Value of the cell |
||
1149 | * @param string $pDataType Explicit data type |
||
1150 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1151 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1152 | */ |
||
1153 | public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = Cell\DataType::TYPE_STRING, $returnCell = false) |
||
1159 | |||
1160 | /** |
||
1161 | * Get cell at a specific coordinate |
||
1162 | * |
||
1163 | * @param string $pCoordinate Coordinate of the cell |
||
1164 | * @param bool $createIfNotExists Flag indicating whether a new cell should be created if it doesn't |
||
1165 | * already exist, or a null should be returned instead |
||
1166 | * @throws Exception |
||
1167 | * @return null|Cell Cell that was found/created or null |
||
1168 | */ |
||
1169 | 62 | public function getCell($pCoordinate = 'A1', $createIfNotExists = true) |
|
1206 | |||
1207 | /** |
||
1208 | * Get cell at a specific coordinate by using numeric cell coordinates |
||
1209 | * |
||
1210 | * @param string $pColumn Numeric column coordinate of the cell |
||
1211 | * @param string $pRow Numeric row coordinate of the cell |
||
1212 | * @param bool $createIfNotExists Flag indicating whether a new cell should be created if it doesn't |
||
1213 | * already exist, or a null should be returned instead |
||
1214 | * @return null|Cell Cell that was found/created or null |
||
1215 | */ |
||
1216 | 29 | public function getCellByColumnAndRow($pColumn = 0, $pRow = 1, $createIfNotExists = true) |
|
1228 | |||
1229 | /** |
||
1230 | * Create a new cell at the specified coordinate |
||
1231 | * |
||
1232 | * @param string $pCoordinate Coordinate of the cell |
||
1233 | * @return Cell Cell that was created |
||
1234 | */ |
||
1235 | 62 | private function createNewCell($pCoordinate) |
|
1265 | |||
1266 | /** |
||
1267 | * Does the cell at a specific coordinate exist? |
||
1268 | * |
||
1269 | * @param string $pCoordinate Coordinate of the cell |
||
1270 | * @throws Exception |
||
1271 | * @return bool |
||
1272 | */ |
||
1273 | 37 | public function cellExists($pCoordinate = 'A1') |
|
1315 | |||
1316 | /** |
||
1317 | * Cell at a specific coordinate by using numeric cell coordinates exists? |
||
1318 | * |
||
1319 | * @param string $pColumn Numeric column coordinate of the cell |
||
1320 | * @param string $pRow Numeric row coordinate of the cell |
||
1321 | * @return bool |
||
1322 | */ |
||
1323 | 3 | public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 1) |
|
1327 | |||
1328 | /** |
||
1329 | * Get row dimension at a specific row |
||
1330 | * |
||
1331 | * @param int $pRow Numeric index of the row |
||
1332 | * @return Worksheet\RowDimension |
||
1333 | */ |
||
1334 | 62 | public function getRowDimension($pRow = 1, $create = true) |
|
1351 | |||
1352 | /** |
||
1353 | * Get column dimension at a specific column |
||
1354 | * |
||
1355 | * @param string $pColumn String index of the column |
||
1356 | * @return Worksheet\ColumnDimension |
||
1357 | */ |
||
1358 | 62 | public function getColumnDimension($pColumn = 'A', $create = true) |
|
1377 | |||
1378 | /** |
||
1379 | * Get column dimension at a specific column by using numeric cell coordinates |
||
1380 | * |
||
1381 | * @param int $pColumn Numeric column coordinate of the cell |
||
1382 | * @return Worksheet\ColumnDimension |
||
1383 | */ |
||
1384 | 3 | public function getColumnDimensionByColumn($pColumn = 0) |
|
1388 | |||
1389 | /** |
||
1390 | * Get styles |
||
1391 | * |
||
1392 | * @return Style[] |
||
1393 | */ |
||
1394 | public function getStyles() |
||
1398 | |||
1399 | /** |
||
1400 | * Get style for cell |
||
1401 | * |
||
1402 | * @param string $pCellCoordinate Cell coordinate (or range) to get style for |
||
1403 | * @throws Exception |
||
1404 | * @return Style |
||
1405 | */ |
||
1406 | 29 | public function getStyle($pCellCoordinate = 'A1') |
|
1416 | |||
1417 | /** |
||
1418 | * Get conditional styles for a cell |
||
1419 | * |
||
1420 | * @param string $pCoordinate |
||
1421 | * @return Style\Conditional[] |
||
1422 | */ |
||
1423 | 2 | public function getConditionalStyles($pCoordinate = 'A1') |
|
1432 | |||
1433 | /** |
||
1434 | * Do conditional styles exist for this cell? |
||
1435 | * |
||
1436 | * @param string $pCoordinate |
||
1437 | * @return bool |
||
1438 | */ |
||
1439 | 10 | public function conditionalStylesExists($pCoordinate = 'A1') |
|
1447 | |||
1448 | /** |
||
1449 | * Removes conditional styles for a cell |
||
1450 | * |
||
1451 | * @param string $pCoordinate |
||
1452 | * @return Worksheet |
||
1453 | */ |
||
1454 | 11 | public function removeConditionalStyles($pCoordinate = 'A1') |
|
1460 | |||
1461 | /** |
||
1462 | * Get collection of conditional styles |
||
1463 | * |
||
1464 | * @return array |
||
1465 | */ |
||
1466 | 58 | public function getConditionalStylesCollection() |
|
1470 | |||
1471 | /** |
||
1472 | * Set conditional styles |
||
1473 | * |
||
1474 | * @param string $pCoordinate eg: 'A1' |
||
1475 | * @param $pValue Style\Conditional[] |
||
1476 | * @return Worksheet |
||
1477 | */ |
||
1478 | 2 | public function setConditionalStyles($pCoordinate, $pValue) |
|
1484 | |||
1485 | /** |
||
1486 | * Get style for cell by using numeric cell coordinates |
||
1487 | * |
||
1488 | * @param int $pColumn Numeric column coordinate of the cell |
||
1489 | * @param int $pRow Numeric row coordinate of the cell |
||
1490 | * @param int pColumn2 Numeric column coordinate of the range cell |
||
1491 | * @param int pRow2 Numeric row coordinate of the range cell |
||
1492 | * @return Style |
||
1493 | */ |
||
1494 | public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1, $pColumn2 = null, $pRow2 = null) |
||
1504 | |||
1505 | /** |
||
1506 | * Duplicate cell style to a range of cells |
||
1507 | * |
||
1508 | * Please note that this will overwrite existing cell styles for cells in range! |
||
1509 | * |
||
1510 | * @param Style $pCellStyle Cell style to duplicate |
||
1511 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
1512 | * @throws Exception |
||
1513 | * @return Worksheet |
||
1514 | */ |
||
1515 | 2 | public function duplicateStyle(Style $pCellStyle = null, $pRange = '') |
|
1550 | |||
1551 | /** |
||
1552 | * Duplicate conditional style to a range of cells |
||
1553 | * |
||
1554 | * Please note that this will overwrite existing cell styles for cells in range! |
||
1555 | * |
||
1556 | * @param Style\Conditional[] $pCellStyle Cell style to duplicate |
||
1557 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
1558 | * @throws Exception |
||
1559 | * @return Worksheet |
||
1560 | */ |
||
1561 | 2 | public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '') |
|
1588 | |||
1589 | /** |
||
1590 | * Set break on a cell |
||
1591 | * |
||
1592 | * @param string $pCell Cell coordinate (e.g. A1) |
||
1593 | * @param int $pBreak Break type (type of Worksheet::BREAK_*) |
||
1594 | * @throws Exception |
||
1595 | * @return Worksheet |
||
1596 | */ |
||
1597 | 1 | public function setBreak($pCell = 'A1', $pBreak = self::BREAK_NONE) |
|
1616 | |||
1617 | /** |
||
1618 | * Set break on a cell by using numeric cell coordinates |
||
1619 | * |
||
1620 | * @param int $pColumn Numeric column coordinate of the cell |
||
1621 | * @param int $pRow Numeric row coordinate of the cell |
||
1622 | * @param int $pBreak Break type (type of \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_*) |
||
1623 | * @return Worksheet |
||
1624 | */ |
||
1625 | public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = self::BREAK_NONE) |
||
1629 | |||
1630 | /** |
||
1631 | * Get breaks |
||
1632 | * |
||
1633 | * @return array[] |
||
1634 | */ |
||
1635 | 59 | public function getBreaks() |
|
1639 | |||
1640 | /** |
||
1641 | * Set merge on a cell range |
||
1642 | * |
||
1643 | * @param string $pRange Cell range (e.g. A1:E1) |
||
1644 | * @throws Exception |
||
1645 | * @return Worksheet |
||
1646 | */ |
||
1647 | 15 | public function mergeCells($pRange = 'A1:A1') |
|
1679 | |||
1680 | /** |
||
1681 | * Set merge on a cell range by using numeric cell coordinates |
||
1682 | * |
||
1683 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1684 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1685 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1686 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1687 | * @throws Exception |
||
1688 | * @return Worksheet |
||
1689 | */ |
||
1690 | public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) |
||
1696 | |||
1697 | /** |
||
1698 | * Remove merge on a cell range |
||
1699 | * |
||
1700 | * @param string $pRange Cell range (e.g. A1:E1) |
||
1701 | * @throws Exception |
||
1702 | * @return Worksheet |
||
1703 | */ |
||
1704 | 9 | public function unmergeCells($pRange = 'A1:A1') |
|
1721 | |||
1722 | /** |
||
1723 | * Remove merge on a cell range by using numeric cell coordinates |
||
1724 | * |
||
1725 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1726 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1727 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1728 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1729 | * @throws Exception |
||
1730 | * @return Worksheet |
||
1731 | */ |
||
1732 | public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) |
||
1738 | |||
1739 | /** |
||
1740 | * Get merge cells array. |
||
1741 | * |
||
1742 | * @return array[] |
||
1743 | */ |
||
1744 | 59 | public function getMergeCells() |
|
1748 | |||
1749 | /** |
||
1750 | * Set merge cells array for the entire sheet. Use instead mergeCells() to merge |
||
1751 | * a single cell range. |
||
1752 | * |
||
1753 | * @param array |
||
1754 | */ |
||
1755 | 12 | public function setMergeCells($pValue = []) |
|
1761 | |||
1762 | /** |
||
1763 | * Set protection on a cell range |
||
1764 | * |
||
1765 | * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) |
||
1766 | * @param string $pPassword Password to unlock the protection |
||
1767 | * @param bool $pAlreadyHashed If the password has already been hashed, set this to true |
||
1768 | * @throws Exception |
||
1769 | * @return Worksheet |
||
1770 | */ |
||
1771 | 9 | public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false) |
|
1783 | |||
1784 | /** |
||
1785 | * Set protection on a cell range by using numeric cell coordinates |
||
1786 | * |
||
1787 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1788 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1789 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1790 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1791 | * @param string $pPassword Password to unlock the protection |
||
1792 | * @param bool $pAlreadyHashed If the password has already been hashed, set this to true |
||
1793 | * @throws Exception |
||
1794 | * @return Worksheet |
||
1795 | */ |
||
1796 | public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) |
||
1802 | |||
1803 | /** |
||
1804 | * Remove protection on a cell range |
||
1805 | * |
||
1806 | * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) |
||
1807 | * @throws Exception |
||
1808 | * @return Worksheet |
||
1809 | */ |
||
1810 | 9 | public function unprotectCells($pRange = 'A1') |
|
1823 | |||
1824 | /** |
||
1825 | * Remove protection on a cell range by using numeric cell coordinates |
||
1826 | * |
||
1827 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1828 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1829 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1830 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1831 | * @param string $pPassword Password to unlock the protection |
||
1832 | * @param bool $pAlreadyHashed If the password has already been hashed, set this to true |
||
1833 | * @throws Exception |
||
1834 | * @return Worksheet |
||
1835 | */ |
||
1836 | public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) |
||
1842 | |||
1843 | /** |
||
1844 | * Get protected cells |
||
1845 | * |
||
1846 | * @return array[] |
||
1847 | */ |
||
1848 | 59 | public function getProtectedCells() |
|
1852 | |||
1853 | /** |
||
1854 | * Get Autofilter |
||
1855 | * |
||
1856 | * @return Worksheet\AutoFilter |
||
1857 | */ |
||
1858 | 60 | public function getAutoFilter() |
|
1862 | |||
1863 | /** |
||
1864 | * Set AutoFilter |
||
1865 | * |
||
1866 | * @param Worksheet\AutoFilter|string $pValue |
||
1867 | * A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility |
||
1868 | * @throws Exception |
||
1869 | * @return Worksheet |
||
1870 | */ |
||
1871 | 4 | public function setAutoFilter($pValue) |
|
1882 | |||
1883 | /** |
||
1884 | * Set Autofilter Range by using numeric cell coordinates |
||
1885 | * |
||
1886 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1887 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1888 | * @param int $pColumn2 Numeric column coordinate of the second cell |
||
1889 | * @param int $pRow2 Numeric row coordinate of the second cell |
||
1890 | * @throws Exception |
||
1891 | * @return Worksheet |
||
1892 | */ |
||
1893 | public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) |
||
1901 | |||
1902 | /** |
||
1903 | * Remove autofilter |
||
1904 | * |
||
1905 | * @return Worksheet |
||
1906 | */ |
||
1907 | public function removeAutoFilter() |
||
1913 | |||
1914 | /** |
||
1915 | * Get Freeze Pane |
||
1916 | * |
||
1917 | * @return string |
||
1918 | */ |
||
1919 | 59 | public function getFreezePane() |
|
1923 | |||
1924 | /** |
||
1925 | * Freeze Pane |
||
1926 | * |
||
1927 | * @param string $pCell Cell (i.e. A2) |
||
1928 | * Examples: |
||
1929 | * A2 will freeze the rows above cell A2 (i.e row 1) |
||
1930 | * B1 will freeze the columns to the left of cell B1 (i.e column A) |
||
1931 | * B2 will freeze the rows above and to the left of cell A2 |
||
1932 | * (i.e row 1 and column A) |
||
1933 | * @throws Exception |
||
1934 | * @return Worksheet |
||
1935 | */ |
||
1936 | 4 | public function freezePane($pCell = '') |
|
1948 | |||
1949 | /** |
||
1950 | * Freeze Pane by using numeric cell coordinates |
||
1951 | * |
||
1952 | * @param int $pColumn Numeric column coordinate of the cell |
||
1953 | * @param int $pRow Numeric row coordinate of the cell |
||
1954 | * @throws Exception |
||
1955 | * @return Worksheet |
||
1956 | */ |
||
1957 | public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 1) |
||
1961 | |||
1962 | /** |
||
1963 | * Unfreeze Pane |
||
1964 | * |
||
1965 | * @return Worksheet |
||
1966 | */ |
||
1967 | public function unfreezePane() |
||
1971 | |||
1972 | /** |
||
1973 | * Insert a new row, updating all possible related data |
||
1974 | * |
||
1975 | * @param int $pBefore Insert before this one |
||
1976 | * @param int $pNumRows Number of rows to insert |
||
1977 | * @throws Exception |
||
1978 | * @return Worksheet |
||
1979 | */ |
||
1980 | 10 | View Code Duplication | public function insertNewRowBefore($pBefore = 1, $pNumRows = 1) |
1991 | |||
1992 | /** |
||
1993 | * Insert a new column, updating all possible related data |
||
1994 | * |
||
1995 | * @param int $pBefore Insert before this one |
||
1996 | * @param int $pNumCols Number of columns to insert |
||
1997 | * @throws Exception |
||
1998 | * @return Worksheet |
||
1999 | */ |
||
2000 | 9 | View Code Duplication | public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1) |
2011 | |||
2012 | /** |
||
2013 | * Insert a new column, updating all possible related data |
||
2014 | * |
||
2015 | * @param int $pBefore Insert before this one (numeric column coordinate of the cell) |
||
2016 | * @param int $pNumCols Number of columns to insert |
||
2017 | * @throws Exception |
||
2018 | * @return Worksheet |
||
2019 | */ |
||
2020 | public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1) |
||
2028 | |||
2029 | /** |
||
2030 | * Delete a row, updating all possible related data |
||
2031 | * |
||
2032 | * @param int $pRow Remove starting with this one |
||
2033 | * @param int $pNumRows Number of rows to remove |
||
2034 | * @throws Exception |
||
2035 | * @return Worksheet |
||
2036 | */ |
||
2037 | 12 | public function removeRow($pRow = 1, $pNumRows = 1) |
|
2053 | |||
2054 | /** |
||
2055 | * Remove a column, updating all possible related data |
||
2056 | * |
||
2057 | * @param string $pColumn Remove starting with this one |
||
2058 | * @param int $pNumCols Number of columns to remove |
||
2059 | * @throws Exception |
||
2060 | * @return Worksheet |
||
2061 | */ |
||
2062 | 9 | public function removeColumn($pColumn = 'A', $pNumCols = 1) |
|
2079 | |||
2080 | /** |
||
2081 | * Remove a column, updating all possible related data |
||
2082 | * |
||
2083 | * @param int $pColumn Remove starting with this one (numeric column coordinate of the cell) |
||
2084 | * @param int $pNumCols Number of columns to remove |
||
2085 | * @throws Exception |
||
2086 | * @return Worksheet |
||
2087 | */ |
||
2088 | public function removeColumnByIndex($pColumn = 0, $pNumCols = 1) |
||
2096 | |||
2097 | /** |
||
2098 | * Show gridlines? |
||
2099 | * |
||
2100 | * @return bool |
||
2101 | */ |
||
2102 | 59 | public function getShowGridlines() |
|
2106 | |||
2107 | /** |
||
2108 | * Set show gridlines |
||
2109 | * |
||
2110 | * @param bool $pValue Show gridlines (true/false) |
||
2111 | * @return Worksheet |
||
2112 | */ |
||
2113 | 9 | public function setShowGridlines($pValue = false) |
|
2119 | |||
2120 | /** |
||
2121 | * Print gridlines? |
||
2122 | * |
||
2123 | * @return bool |
||
2124 | */ |
||
2125 | 58 | public function getPrintGridlines() |
|
2129 | |||
2130 | /** |
||
2131 | * Set print gridlines |
||
2132 | * |
||
2133 | * @param bool $pValue Print gridlines (true/false) |
||
2134 | * @return Worksheet |
||
2135 | */ |
||
2136 | 4 | public function setPrintGridlines($pValue = false) |
|
2142 | |||
2143 | /** |
||
2144 | * Show row and column headers? |
||
2145 | * |
||
2146 | * @return bool |
||
2147 | */ |
||
2148 | 58 | public function getShowRowColHeaders() |
|
2152 | |||
2153 | /** |
||
2154 | * Set show row and column headers |
||
2155 | * |
||
2156 | * @param bool $pValue Show row and column headers (true/false) |
||
2157 | * @return Worksheet |
||
2158 | */ |
||
2159 | 9 | public function setShowRowColHeaders($pValue = false) |
|
2165 | |||
2166 | /** |
||
2167 | * Show summary below? (Row/Column outlining) |
||
2168 | * |
||
2169 | * @return bool |
||
2170 | */ |
||
2171 | 58 | public function getShowSummaryBelow() |
|
2175 | |||
2176 | /** |
||
2177 | * Set show summary below |
||
2178 | * |
||
2179 | * @param bool $pValue Show summary below (true/false) |
||
2180 | * @return Worksheet |
||
2181 | */ |
||
2182 | 9 | public function setShowSummaryBelow($pValue = true) |
|
2188 | |||
2189 | /** |
||
2190 | * Show summary right? (Row/Column outlining) |
||
2191 | * |
||
2192 | * @return bool |
||
2193 | */ |
||
2194 | 58 | public function getShowSummaryRight() |
|
2198 | |||
2199 | /** |
||
2200 | * Set show summary right |
||
2201 | * |
||
2202 | * @param bool $pValue Show summary right (true/false) |
||
2203 | * @return Worksheet |
||
2204 | */ |
||
2205 | 9 | public function setShowSummaryRight($pValue = true) |
|
2211 | |||
2212 | /** |
||
2213 | * Get comments |
||
2214 | * |
||
2215 | * @return Comment[] |
||
2216 | */ |
||
2217 | 58 | public function getComments() |
|
2221 | |||
2222 | /** |
||
2223 | * Set comments array for the entire sheet. |
||
2224 | * |
||
2225 | * @param array of Comment |
||
2226 | * @return Worksheet |
||
2227 | */ |
||
2228 | 12 | public function setComments($pValue = []) |
|
2234 | |||
2235 | /** |
||
2236 | * Get comment for cell |
||
2237 | * |
||
2238 | * @param string $pCellCoordinate Cell coordinate to get comment for |
||
2239 | * @throws Exception |
||
2240 | * @return Comment |
||
2241 | */ |
||
2242 | 13 | public function getComment($pCellCoordinate = 'A1') |
|
2266 | |||
2267 | /** |
||
2268 | * Get comment for cell by using numeric cell coordinates |
||
2269 | * |
||
2270 | * @param int $pColumn Numeric column coordinate of the cell |
||
2271 | * @param int $pRow Numeric row coordinate of the cell |
||
2272 | * @return Comment |
||
2273 | */ |
||
2274 | 2 | public function getCommentByColumnAndRow($pColumn = 0, $pRow = 1) |
|
2278 | |||
2279 | /** |
||
2280 | * Get active cell |
||
2281 | * |
||
2282 | * @return string Example: 'A1' |
||
2283 | */ |
||
2284 | 57 | public function getActiveCell() |
|
2288 | |||
2289 | /** |
||
2290 | * Get selected cells |
||
2291 | * |
||
2292 | * @return string |
||
2293 | */ |
||
2294 | 45 | public function getSelectedCells() |
|
2298 | |||
2299 | /** |
||
2300 | * Selected cell |
||
2301 | * |
||
2302 | * @param string $pCoordinate Cell (i.e. A1) |
||
2303 | * @return Worksheet |
||
2304 | */ |
||
2305 | public function setSelectedCell($pCoordinate = 'A1') |
||
2309 | |||
2310 | /** |
||
2311 | * Select a range of cells. |
||
2312 | * |
||
2313 | * @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6' |
||
2314 | * @throws Exception |
||
2315 | * @return Worksheet |
||
2316 | */ |
||
2317 | 38 | public function setSelectedCells($pCoordinate = 'A1') |
|
2344 | |||
2345 | /** |
||
2346 | * Selected cell by using numeric cell coordinates |
||
2347 | * |
||
2348 | * @param int $pColumn Numeric column coordinate of the cell |
||
2349 | * @param int $pRow Numeric row coordinate of the cell |
||
2350 | * @throws Exception |
||
2351 | * @return Worksheet |
||
2352 | */ |
||
2353 | public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 1) |
||
2357 | |||
2358 | /** |
||
2359 | * Get right-to-left |
||
2360 | * |
||
2361 | * @return bool |
||
2362 | */ |
||
2363 | 58 | public function getRightToLeft() |
|
2367 | |||
2368 | /** |
||
2369 | * Set right-to-left |
||
2370 | * |
||
2371 | * @param bool $value Right-to-left true/false |
||
2372 | * @return Worksheet |
||
2373 | */ |
||
2374 | 4 | public function setRightToLeft($value = false) |
|
2380 | |||
2381 | /** |
||
2382 | * Fill worksheet from values in array |
||
2383 | * |
||
2384 | * @param array $source Source array |
||
2385 | * @param mixed $nullValue Value in source array that stands for blank cell |
||
2386 | * @param string $startCell Insert array starting from this cell address as the top left coordinate |
||
2387 | * @param bool $strictNullComparison Apply strict comparison when testing for null values in the array |
||
2388 | * @throws Exception |
||
2389 | * @return Worksheet |
||
2390 | */ |
||
2391 | 17 | public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) |
|
2427 | |||
2428 | /** |
||
2429 | * Create array from a range of cells |
||
2430 | * |
||
2431 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
2432 | * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist |
||
2433 | * @param bool $calculateFormulas Should formulas be calculated? |
||
2434 | * @param bool $formatData Should formatting be applied to cell values? |
||
2435 | * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero |
||
2436 | * True - Return rows and columns indexed by their actual row and column IDs |
||
2437 | * @return array |
||
2438 | */ |
||
2439 | 2 | public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) |
|
2496 | |||
2497 | /** |
||
2498 | * Create array from a range of cells |
||
2499 | * |
||
2500 | * @param string $pNamedRange Name of the Named Range |
||
2501 | * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist |
||
2502 | * @param bool $calculateFormulas Should formulas be calculated? |
||
2503 | * @param bool $formatData Should formatting be applied to cell values? |
||
2504 | * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero |
||
2505 | * True - Return rows and columns indexed by their actual row and column IDs |
||
2506 | * @throws Exception |
||
2507 | * @return array |
||
2508 | */ |
||
2509 | public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) |
||
2521 | |||
2522 | /** |
||
2523 | * Create array from worksheet |
||
2524 | * |
||
2525 | * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist |
||
2526 | * @param bool $calculateFormulas Should formulas be calculated? |
||
2527 | * @param bool $formatData Should formatting be applied to cell values? |
||
2528 | * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero |
||
2529 | * True - Return rows and columns indexed by their actual row and column IDs |
||
2530 | * @return array |
||
2531 | */ |
||
2532 | public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) |
||
2543 | |||
2544 | /** |
||
2545 | * Get row iterator |
||
2546 | * |
||
2547 | * @param int $startRow The row number at which to start iterating |
||
2548 | * @param int $endRow The row number at which to stop iterating |
||
2549 | * |
||
2550 | * @return Worksheet\RowIterator |
||
2551 | */ |
||
2552 | 2 | public function getRowIterator($startRow = 1, $endRow = null) |
|
2556 | |||
2557 | /** |
||
2558 | * Get column iterator |
||
2559 | * |
||
2560 | * @param string $startColumn The column address at which to start iterating |
||
2561 | * @param string $endColumn The column address at which to stop iterating |
||
2562 | * |
||
2563 | * @return Worksheet\ColumnIterator |
||
2564 | */ |
||
2565 | public function getColumnIterator($startColumn = 'A', $endColumn = null) |
||
2569 | |||
2570 | /** |
||
2571 | * Run PhpSpreadsheet garabage collector. |
||
2572 | * |
||
2573 | * @return Worksheet |
||
2574 | */ |
||
2575 | 59 | public function garbageCollect() |
|
2606 | |||
2607 | /** |
||
2608 | * Get hash code |
||
2609 | * |
||
2610 | * @return string Hash code |
||
2611 | */ |
||
2612 | 60 | public function getHashCode() |
|
2621 | |||
2622 | /** |
||
2623 | * Extract worksheet title from range. |
||
2624 | * |
||
2625 | * Example: extractSheetTitle("testSheet!A1") ==> 'A1' |
||
2626 | * Example: extractSheetTitle("'testSheet 1'!A1", true) ==> array('testSheet 1', 'A1'); |
||
2627 | * |
||
2628 | * @param string $pRange Range to extract title from |
||
2629 | * @param bool $returnRange Return range? (see example) |
||
2630 | * @return mixed |
||
2631 | */ |
||
2632 | 1 | public static function extractSheetTitle($pRange, $returnRange = false) |
|
2645 | |||
2646 | /** |
||
2647 | * Get hyperlink |
||
2648 | * |
||
2649 | * @param string $pCellCoordinate Cell coordinate to get hyperlink for |
||
2650 | */ |
||
2651 | 11 | View Code Duplication | public function getHyperlink($pCellCoordinate = 'A1') |
2663 | |||
2664 | /** |
||
2665 | * Set hyperlnk |
||
2666 | * |
||
2667 | * @param string $pCellCoordinate Cell coordinate to insert hyperlink |
||
2668 | * @param Cell\Hyperlink $pHyperlink |
||
2669 | * @return Worksheet |
||
2670 | */ |
||
2671 | 10 | public function setHyperlink($pCellCoordinate = 'A1', Cell\Hyperlink $pHyperlink = null) |
|
2681 | |||
2682 | /** |
||
2683 | * Hyperlink at a specific coordinate exists? |
||
2684 | * |
||
2685 | * @param string $pCoordinate |
||
2686 | * @return bool |
||
2687 | */ |
||
2688 | 3 | public function hyperlinkExists($pCoordinate = 'A1') |
|
2692 | |||
2693 | /** |
||
2694 | * Get collection of hyperlinks |
||
2695 | * |
||
2696 | * @return Cell\Hyperlink[] |
||
2697 | */ |
||
2698 | 59 | public function getHyperlinkCollection() |
|
2702 | |||
2703 | /** |
||
2704 | * Get data validation |
||
2705 | * |
||
2706 | * @param string $pCellCoordinate Cell coordinate to get data validation for |
||
2707 | */ |
||
2708 | 2 | View Code Duplication | public function getDataValidation($pCellCoordinate = 'A1') |
2720 | |||
2721 | /** |
||
2722 | * Set data validation |
||
2723 | * |
||
2724 | * @param string $pCellCoordinate Cell coordinate to insert data validation |
||
2725 | * @param Cell\DataValidation $pDataValidation |
||
2726 | * @return Worksheet |
||
2727 | */ |
||
2728 | public function setDataValidation($pCellCoordinate = 'A1', Cell\DataValidation $pDataValidation = null) |
||
2738 | |||
2739 | /** |
||
2740 | * Data validation at a specific coordinate exists? |
||
2741 | * |
||
2742 | * @param string $pCoordinate |
||
2743 | * @return bool |
||
2744 | */ |
||
2745 | public function dataValidationExists($pCoordinate = 'A1') |
||
2749 | |||
2750 | /** |
||
2751 | * Get collection of data validations |
||
2752 | * |
||
2753 | * @return Cell\DataValidation[] |
||
2754 | */ |
||
2755 | 59 | public function getDataValidationCollection() |
|
2759 | |||
2760 | /** |
||
2761 | * Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet |
||
2762 | * |
||
2763 | * @param string $range |
||
2764 | * @return string Adjusted range value |
||
2765 | */ |
||
2766 | public function shrinkRangeToFit($range) |
||
2795 | |||
2796 | /** |
||
2797 | * Get tab color |
||
2798 | * |
||
2799 | * @return Style\Color |
||
2800 | */ |
||
2801 | 9 | public function getTabColor() |
|
2809 | |||
2810 | /** |
||
2811 | * Reset tab color |
||
2812 | * |
||
2813 | * @return Worksheet |
||
2814 | */ |
||
2815 | public function resetTabColor() |
||
2822 | |||
2823 | /** |
||
2824 | * Tab color set? |
||
2825 | * |
||
2826 | * @return bool |
||
2827 | */ |
||
2828 | 58 | public function isTabColorSet() |
|
2832 | |||
2833 | /** |
||
2834 | * Copy worksheet (!= clone!) |
||
2835 | * |
||
2836 | * @return Worksheet |
||
2837 | */ |
||
2838 | public function copy() |
||
2844 | |||
2845 | /** |
||
2846 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
||
2847 | */ |
||
2848 | 1 | public function __clone() |
|
2873 | /** |
||
2874 | * Define the code name of the sheet |
||
2875 | * |
||
2876 | * @param null|string Same rule as Title minus space not allowed (but, like Excel, change silently space to underscore) |
||
2877 | * @throws Exception |
||
2878 | * @return objWorksheet |
||
2879 | */ |
||
2880 | 70 | public function setCodeName($pValue = null) |
|
2925 | /** |
||
2926 | * Return the code name of the sheet |
||
2927 | * |
||
2928 | * @return null|string |
||
2929 | */ |
||
2930 | 70 | public function getCodeName() |
|
2934 | /** |
||
2935 | * Sheet has a code name ? |
||
2936 | * @return bool |
||
2937 | */ |
||
2938 | public function hasCodeName() |
||
2942 | } |
||
2943 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..