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 |
||
27 | class Worksheet implements IComparable |
||
28 | { |
||
29 | /* Break types */ |
||
30 | const BREAK_NONE = 0; |
||
31 | const BREAK_ROW = 1; |
||
32 | const BREAK_COLUMN = 2; |
||
33 | |||
34 | /* Sheet state */ |
||
35 | const SHEETSTATE_VISIBLE = 'visible'; |
||
36 | const SHEETSTATE_HIDDEN = 'hidden'; |
||
37 | const SHEETSTATE_VERYHIDDEN = 'veryHidden'; |
||
38 | |||
39 | /** |
||
40 | * Invalid characters in sheet title |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | private static $invalidCharacters = ['*', ':', '/', '\\', '?', '[', ']']; |
||
45 | |||
46 | /** |
||
47 | * Parent spreadsheet |
||
48 | * |
||
49 | * @var Spreadsheet |
||
50 | */ |
||
51 | private $parent; |
||
52 | |||
53 | /** |
||
54 | * Cacheable collection of cells |
||
55 | * |
||
56 | * @var CachedObjectStorage_xxx |
||
57 | */ |
||
58 | private $cellCollection; |
||
59 | |||
60 | /** |
||
61 | * Collection of row dimensions |
||
62 | * |
||
63 | * @var Worksheet\RowDimension[] |
||
64 | */ |
||
65 | private $rowDimensions = []; |
||
66 | |||
67 | /** |
||
68 | * Default row dimension |
||
69 | * |
||
70 | * @var Worksheet\RowDimension |
||
71 | */ |
||
72 | private $defaultRowDimension; |
||
73 | |||
74 | /** |
||
75 | * Collection of column dimensions |
||
76 | * |
||
77 | * @var Worksheet\ColumnDimension[] |
||
78 | */ |
||
79 | private $columnDimensions = []; |
||
80 | |||
81 | /** |
||
82 | * Default column dimension |
||
83 | * |
||
84 | * @var Worksheet\ColumnDimension |
||
85 | */ |
||
86 | private $defaultColumnDimension = null; |
||
87 | |||
88 | /** |
||
89 | * Collection of drawings |
||
90 | * |
||
91 | * @var Worksheet\BaseDrawing[] |
||
92 | */ |
||
93 | private $drawingCollection = null; |
||
94 | |||
95 | /** |
||
96 | * Collection of Chart objects |
||
97 | * |
||
98 | * @var Chart[] |
||
99 | */ |
||
100 | private $chartCollection = []; |
||
101 | |||
102 | /** |
||
103 | * Worksheet title |
||
104 | * |
||
105 | * @var string |
||
106 | */ |
||
107 | private $title; |
||
108 | |||
109 | /** |
||
110 | * Sheet state |
||
111 | * |
||
112 | * @var string |
||
113 | */ |
||
114 | private $sheetState; |
||
115 | |||
116 | /** |
||
117 | * Page setup |
||
118 | * |
||
119 | * @var Worksheet\PageSetup |
||
120 | */ |
||
121 | private $pageSetup; |
||
122 | |||
123 | /** |
||
124 | * Page margins |
||
125 | * |
||
126 | * @var Worksheet\PageMargins |
||
127 | */ |
||
128 | private $pageMargins; |
||
129 | |||
130 | /** |
||
131 | * Page header/footer |
||
132 | * |
||
133 | * @var Worksheet\HeaderFooter |
||
134 | */ |
||
135 | private $headerFooter; |
||
136 | |||
137 | /** |
||
138 | * Sheet view |
||
139 | * |
||
140 | * @var Worksheet\SheetView |
||
141 | */ |
||
142 | private $sheetView; |
||
143 | |||
144 | /** |
||
145 | * Protection |
||
146 | * |
||
147 | * @var Worksheet\Protection |
||
148 | */ |
||
149 | private $protection; |
||
150 | |||
151 | /** |
||
152 | * Collection of styles |
||
153 | * |
||
154 | * @var Style[] |
||
155 | */ |
||
156 | private $styles = []; |
||
157 | |||
158 | /** |
||
159 | * Conditional styles. Indexed by cell coordinate, e.g. 'A1' |
||
160 | * |
||
161 | * @var array |
||
162 | */ |
||
163 | private $conditionalStylesCollection = []; |
||
164 | |||
165 | /** |
||
166 | * Is the current cell collection sorted already? |
||
167 | * |
||
168 | * @var bool |
||
169 | */ |
||
170 | private $cellCollectionIsSorted = false; |
||
171 | |||
172 | /** |
||
173 | * Collection of breaks |
||
174 | * |
||
175 | * @var array |
||
176 | */ |
||
177 | private $breaks = []; |
||
178 | |||
179 | /** |
||
180 | * Collection of merged cell ranges |
||
181 | * |
||
182 | * @var array |
||
183 | */ |
||
184 | private $mergeCells = []; |
||
185 | |||
186 | /** |
||
187 | * Collection of protected cell ranges |
||
188 | * |
||
189 | * @var array |
||
190 | */ |
||
191 | private $protectedCells = []; |
||
192 | |||
193 | /** |
||
194 | * Autofilter Range and selection |
||
195 | * |
||
196 | * @var Worksheet\AutoFilter |
||
197 | */ |
||
198 | private $autoFilter; |
||
199 | |||
200 | /** |
||
201 | * Freeze pane |
||
202 | * |
||
203 | * @var string |
||
204 | */ |
||
205 | private $freezePane = ''; |
||
206 | |||
207 | /** |
||
208 | * Show gridlines? |
||
209 | * |
||
210 | * @var bool |
||
211 | */ |
||
212 | private $showGridlines = true; |
||
213 | |||
214 | /** |
||
215 | * Print gridlines? |
||
216 | * |
||
217 | * @var bool |
||
218 | */ |
||
219 | private $printGridlines = false; |
||
220 | |||
221 | /** |
||
222 | * Show row and column headers? |
||
223 | * |
||
224 | * @var bool |
||
225 | */ |
||
226 | private $showRowColHeaders = true; |
||
227 | |||
228 | /** |
||
229 | * Show summary below? (Row/Column outline) |
||
230 | * |
||
231 | * @var bool |
||
232 | */ |
||
233 | private $showSummaryBelow = true; |
||
234 | |||
235 | /** |
||
236 | * Show summary right? (Row/Column outline) |
||
237 | * |
||
238 | * @var bool |
||
239 | */ |
||
240 | private $showSummaryRight = true; |
||
241 | |||
242 | /** |
||
243 | * Collection of comments |
||
244 | * |
||
245 | * @var Comment[] |
||
246 | */ |
||
247 | private $comments = []; |
||
248 | |||
249 | /** |
||
250 | * Active cell. (Only one!) |
||
251 | * |
||
252 | * @var string |
||
253 | */ |
||
254 | private $activeCell = 'A1'; |
||
255 | |||
256 | /** |
||
257 | * Selected cells |
||
258 | * |
||
259 | * @var string |
||
260 | */ |
||
261 | private $selectedCells = 'A1'; |
||
262 | |||
263 | /** |
||
264 | * Cached highest column |
||
265 | * |
||
266 | * @var string |
||
267 | */ |
||
268 | private $cachedHighestColumn = 'A'; |
||
269 | |||
270 | /** |
||
271 | * Cached highest row |
||
272 | * |
||
273 | * @var int |
||
274 | */ |
||
275 | private $cachedHighestRow = 1; |
||
276 | |||
277 | /** |
||
278 | * Right-to-left? |
||
279 | * |
||
280 | * @var bool |
||
281 | */ |
||
282 | private $rightToLeft = false; |
||
283 | |||
284 | /** |
||
285 | * Hyperlinks. Indexed by cell coordinate, e.g. 'A1' |
||
286 | * |
||
287 | * @var array |
||
288 | */ |
||
289 | private $hyperlinkCollection = []; |
||
290 | |||
291 | /** |
||
292 | * Data validation objects. Indexed by cell coordinate, e.g. 'A1' |
||
293 | * |
||
294 | * @var array |
||
295 | */ |
||
296 | private $dataValidationCollection = []; |
||
297 | |||
298 | /** |
||
299 | * Tab color |
||
300 | * |
||
301 | * @var Style\Color |
||
302 | */ |
||
303 | private $tabColor; |
||
304 | |||
305 | /** |
||
306 | * Dirty flag |
||
307 | * |
||
308 | * @var bool |
||
309 | */ |
||
310 | private $dirty = true; |
||
311 | |||
312 | /** |
||
313 | * Hash |
||
314 | * |
||
315 | * @var string |
||
316 | */ |
||
317 | private $hash; |
||
318 | |||
319 | /** |
||
320 | * CodeName |
||
321 | * |
||
322 | * @var string |
||
323 | */ |
||
324 | private $codeName = null; |
||
325 | |||
326 | /** |
||
327 | * Create a new worksheet |
||
328 | * |
||
329 | * @param Spreadsheet $parent |
||
330 | * @param string $pTitle |
||
331 | */ |
||
332 | 70 | public function __construct(Spreadsheet $parent = null, $pTitle = 'Worksheet') |
|
362 | |||
363 | /** |
||
364 | * Disconnect all cells from this Worksheet object, |
||
365 | * typically so that the worksheet object can be unset |
||
366 | */ |
||
367 | 1 | public function disconnectCells() |
|
376 | |||
377 | /** |
||
378 | * Code to execute when this worksheet is unset() |
||
379 | */ |
||
380 | 1 | public function __destruct() |
|
386 | |||
387 | /** |
||
388 | * Return the cache controller for the cell collection |
||
389 | * |
||
390 | * @return CachedObjectStorage_xxx |
||
391 | */ |
||
392 | 62 | public function getCellCacheController() |
|
396 | |||
397 | /** |
||
398 | * Get array of invalid characters for sheet title |
||
399 | * |
||
400 | * @return array |
||
401 | */ |
||
402 | public static function getInvalidCharacters() |
||
406 | |||
407 | /** |
||
408 | * Check sheet code name for valid Excel syntax |
||
409 | * |
||
410 | * @param string $pValue The string to check |
||
411 | * @throws Exception |
||
412 | * @return string The valid string |
||
413 | */ |
||
414 | 70 | private static function checkSheetCodeName($pValue) |
|
434 | |||
435 | /** |
||
436 | * Check sheet title for valid Excel syntax |
||
437 | * |
||
438 | * @param string $pValue The string to check |
||
439 | * @throws Exception |
||
440 | * @return string The valid string |
||
441 | */ |
||
442 | 70 | private static function checkSheetTitle($pValue) |
|
456 | |||
457 | /** |
||
458 | * Get collection of cells |
||
459 | * |
||
460 | * @param bool $pSorted Also sort the cell collection? |
||
461 | * @return Cell[] |
||
462 | */ |
||
463 | 60 | public function getCellCollection($pSorted = true) |
|
475 | |||
476 | /** |
||
477 | * Sort collection of cells |
||
478 | * |
||
479 | * @return Worksheet |
||
480 | */ |
||
481 | 60 | public function sortCellCollection() |
|
489 | |||
490 | /** |
||
491 | * Get collection of row dimensions |
||
492 | * |
||
493 | * @return Worksheet\RowDimension[] |
||
494 | */ |
||
495 | 59 | public function getRowDimensions() |
|
499 | |||
500 | /** |
||
501 | * Get default row dimension |
||
502 | * |
||
503 | * @return Worksheet\RowDimension |
||
504 | */ |
||
505 | 59 | public function getDefaultRowDimension() |
|
509 | |||
510 | /** |
||
511 | * Get collection of column dimensions |
||
512 | * |
||
513 | * @return Worksheet\ColumnDimension[] |
||
514 | */ |
||
515 | 59 | public function getColumnDimensions() |
|
519 | |||
520 | /** |
||
521 | * Get default column dimension |
||
522 | * |
||
523 | * @return Worksheet\ColumnDimension |
||
524 | */ |
||
525 | 58 | public function getDefaultColumnDimension() |
|
529 | |||
530 | /** |
||
531 | * Get collection of drawings |
||
532 | * |
||
533 | * @return Worksheet\BaseDrawing[] |
||
534 | */ |
||
535 | 59 | public function getDrawingCollection() |
|
539 | |||
540 | /** |
||
541 | * Get collection of charts |
||
542 | * |
||
543 | * @return Chart[] |
||
544 | */ |
||
545 | 14 | public function getChartCollection() |
|
549 | |||
550 | /** |
||
551 | * Add chart |
||
552 | * |
||
553 | * @param Chart $pChart |
||
554 | * @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last) |
||
555 | * @return Chart |
||
556 | */ |
||
557 | 14 | public function addChart(Chart $pChart = null, $iChartIndex = null) |
|
569 | |||
570 | /** |
||
571 | * Return the count of charts on this worksheet |
||
572 | * |
||
573 | * @return int The number of charts |
||
574 | */ |
||
575 | 14 | public function getChartCount() |
|
579 | |||
580 | /** |
||
581 | * Get a chart by its index position |
||
582 | * |
||
583 | * @param string $index Chart index position |
||
584 | * @throws Exception |
||
585 | * @return false|Chart |
||
586 | */ |
||
587 | 13 | public function getChartByIndex($index = null) |
|
602 | |||
603 | /** |
||
604 | * Return an array of the names of charts on this worksheet |
||
605 | * |
||
606 | * @throws Exception |
||
607 | * @return string[] The names of charts |
||
608 | */ |
||
609 | 1 | public function getChartNames() |
|
618 | |||
619 | /** |
||
620 | * Get a chart by name |
||
621 | * |
||
622 | * @param string $chartName Chart name |
||
623 | * @throws Exception |
||
624 | * @return false|Chart |
||
625 | */ |
||
626 | 1 | public function getChartByName($chartName = '') |
|
640 | |||
641 | /** |
||
642 | * Refresh column dimensions |
||
643 | * |
||
644 | * @return Worksheet |
||
645 | */ |
||
646 | 12 | public function refreshColumnDimensions() |
|
659 | |||
660 | /** |
||
661 | * Refresh row dimensions |
||
662 | * |
||
663 | * @return Worksheet |
||
664 | */ |
||
665 | 2 | public function refreshRowDimensions() |
|
678 | |||
679 | /** |
||
680 | * Calculate worksheet dimension |
||
681 | * |
||
682 | * @return string String containing the dimension of this worksheet |
||
683 | */ |
||
684 | 58 | public function calculateWorksheetDimension() |
|
689 | |||
690 | /** |
||
691 | * Calculate worksheet data dimension |
||
692 | * |
||
693 | * @return string String containing the dimension of this worksheet that actually contain data |
||
694 | */ |
||
695 | public function calculateWorksheetDataDimension() |
||
700 | |||
701 | /** |
||
702 | * Calculate widths for auto-size columns |
||
703 | * |
||
704 | * @return Worksheet; |
||
705 | */ |
||
706 | 43 | public function calculateColumnWidths() |
|
778 | |||
779 | /** |
||
780 | * Get parent |
||
781 | * |
||
782 | * @return Spreadsheet |
||
783 | */ |
||
784 | 70 | public function getParent() |
|
788 | |||
789 | /** |
||
790 | * Re-bind parent |
||
791 | * |
||
792 | * @param Spreadsheet $parent |
||
793 | * @return Worksheet |
||
794 | */ |
||
795 | 1 | public function rebindParent(Spreadsheet $parent) |
|
811 | |||
812 | /** |
||
813 | * Get title |
||
814 | * |
||
815 | * @return string |
||
816 | */ |
||
817 | 70 | public function getTitle() |
|
821 | |||
822 | /** |
||
823 | * Set title |
||
824 | * |
||
825 | * @param string $pValue String containing the dimension of this worksheet |
||
826 | * @param string $updateFormulaCellReferences boolean Flag indicating whether cell references in formulae should |
||
827 | * be updated to reflect the new sheet name. |
||
828 | * This should be left as the default true, unless you are |
||
829 | * certain that no formula cells on any worksheet contain |
||
830 | * references to this worksheet |
||
831 | * @return Worksheet |
||
832 | */ |
||
833 | 70 | public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true) |
|
890 | |||
891 | /** |
||
892 | * Get sheet state |
||
893 | * |
||
894 | * @return string Sheet state (visible, hidden, veryHidden) |
||
895 | */ |
||
896 | 58 | public function getSheetState() |
|
900 | |||
901 | /** |
||
902 | * Set sheet state |
||
903 | * |
||
904 | * @param string $value Sheet state (visible, hidden, veryHidden) |
||
905 | * @return Worksheet |
||
906 | */ |
||
907 | 70 | public function setSheetState($value = self::SHEETSTATE_VISIBLE) |
|
913 | |||
914 | /** |
||
915 | * Get page setup |
||
916 | * |
||
917 | * @return Worksheet\PageSetup |
||
918 | */ |
||
919 | 59 | public function getPageSetup() |
|
923 | |||
924 | /** |
||
925 | * Set page setup |
||
926 | * |
||
927 | * @param Worksheet\PageSetup $pValue |
||
928 | * @return Worksheet |
||
929 | */ |
||
930 | public function setPageSetup(Worksheet\PageSetup $pValue) |
||
936 | |||
937 | /** |
||
938 | * Get page margins |
||
939 | * |
||
940 | * @return Worksheet\PageMargins |
||
941 | */ |
||
942 | 59 | public function getPageMargins() |
|
946 | |||
947 | /** |
||
948 | * Set page margins |
||
949 | * |
||
950 | * @param Worksheet\PageMargins $pValue |
||
951 | * @return Worksheet |
||
952 | */ |
||
953 | public function setPageMargins(Worksheet\PageMargins $pValue) |
||
959 | |||
960 | /** |
||
961 | * Get page header/footer |
||
962 | * |
||
963 | * @return Worksheet\HeaderFooter |
||
964 | */ |
||
965 | 59 | public function getHeaderFooter() |
|
969 | |||
970 | /** |
||
971 | * Set page header/footer |
||
972 | * |
||
973 | * @param Worksheet\HeaderFooter $pValue |
||
974 | * @return Worksheet |
||
975 | */ |
||
976 | public function setHeaderFooter(Worksheet\HeaderFooter $pValue) |
||
982 | |||
983 | /** |
||
984 | * Get sheet view |
||
985 | * |
||
986 | * @return Worksheet\SheetView |
||
987 | */ |
||
988 | 58 | public function getSheetView() |
|
992 | |||
993 | /** |
||
994 | * Set sheet view |
||
995 | * |
||
996 | * @param Worksheet\SheetView $pValue |
||
997 | * @return Worksheet |
||
998 | */ |
||
999 | public function setSheetView(Worksheet\SheetView $pValue) |
||
1005 | |||
1006 | /** |
||
1007 | * Get Protection |
||
1008 | * |
||
1009 | * @return Worksheet\Protection |
||
1010 | */ |
||
1011 | 59 | public function getProtection() |
|
1015 | |||
1016 | /** |
||
1017 | * Set Protection |
||
1018 | * |
||
1019 | * @param Worksheet\Protection $pValue |
||
1020 | * @return Worksheet |
||
1021 | */ |
||
1022 | public function setProtection(Worksheet\Protection $pValue) |
||
1029 | |||
1030 | /** |
||
1031 | * Get highest worksheet column |
||
1032 | * |
||
1033 | * @param string $row Return the data highest column for the specified row, |
||
1034 | * or the highest column of any row if no row number is passed |
||
1035 | * @return string Highest column name |
||
1036 | */ |
||
1037 | 60 | public function getHighestColumn($row = null) |
|
1045 | |||
1046 | /** |
||
1047 | * Get highest worksheet column that contains data |
||
1048 | * |
||
1049 | * @param string $row Return the highest data column for the specified row, |
||
1050 | * or the highest data column of any row if no row number is passed |
||
1051 | * @return string Highest column name that contains data |
||
1052 | */ |
||
1053 | 10 | public function getHighestDataColumn($row = null) |
|
1057 | |||
1058 | /** |
||
1059 | * Get highest worksheet row |
||
1060 | * |
||
1061 | * @param string $column Return the highest data row for the specified column, |
||
1062 | * or the highest row of any column if no column letter is passed |
||
1063 | * @return int Highest row number |
||
1064 | */ |
||
1065 | 60 | public function getHighestRow($column = null) |
|
1073 | |||
1074 | /** |
||
1075 | * Get highest worksheet row that contains data |
||
1076 | * |
||
1077 | * @param string $column Return the highest data row for the specified column, |
||
1078 | * or the highest data row of any column if no column letter is passed |
||
1079 | * @return string Highest row number that contains data |
||
1080 | */ |
||
1081 | 12 | public function getHighestDataRow($column = null) |
|
1085 | |||
1086 | /** |
||
1087 | * Get highest worksheet column and highest row that have cell records |
||
1088 | * |
||
1089 | * @return array Highest column name and highest row number |
||
1090 | */ |
||
1091 | public function getHighestRowAndColumn() |
||
1095 | |||
1096 | /** |
||
1097 | * Set a cell value |
||
1098 | * |
||
1099 | * @param string $pCoordinate Coordinate of the cell |
||
1100 | * @param mixed $pValue Value of the cell |
||
1101 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1102 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1103 | */ |
||
1104 | 36 | public function setCellValue($pCoordinate = 'A1', $pValue = null, $returnCell = false) |
|
1110 | |||
1111 | /** |
||
1112 | * Set a cell value by using numeric cell coordinates |
||
1113 | * |
||
1114 | * @param int $pColumn Numeric column coordinate of the cell (A = 0) |
||
1115 | * @param int $pRow Numeric row coordinate of the cell |
||
1116 | * @param mixed $pValue Value of the cell |
||
1117 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1118 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1119 | */ |
||
1120 | public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $returnCell = false) |
||
1126 | |||
1127 | /** |
||
1128 | * Set a cell value |
||
1129 | * |
||
1130 | * @param string $pCoordinate Coordinate of the cell |
||
1131 | * @param mixed $pValue Value of the cell |
||
1132 | * @param string $pDataType Explicit data type |
||
1133 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1134 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1135 | */ |
||
1136 | public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = Cell\DataType::TYPE_STRING, $returnCell = false) |
||
1143 | |||
1144 | /** |
||
1145 | * Set a cell value by using numeric cell coordinates |
||
1146 | * |
||
1147 | * @param int $pColumn Numeric column coordinate of the cell |
||
1148 | * @param int $pRow Numeric row coordinate of the cell |
||
1149 | * @param mixed $pValue Value of the cell |
||
1150 | * @param string $pDataType Explicit data type |
||
1151 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1152 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1153 | */ |
||
1154 | public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = Cell\DataType::TYPE_STRING, $returnCell = false) |
||
1160 | |||
1161 | /** |
||
1162 | * Get cell at a specific coordinate |
||
1163 | * |
||
1164 | * @param string $pCoordinate Coordinate of the cell |
||
1165 | * @param bool $createIfNotExists Flag indicating whether a new cell should be created if it doesn't |
||
1166 | * already exist, or a null should be returned instead |
||
1167 | * @throws Exception |
||
1168 | * @return null|Cell Cell that was found/created or null |
||
1169 | */ |
||
1170 | 62 | public function getCell($pCoordinate = 'A1', $createIfNotExists = true) |
|
1207 | |||
1208 | /** |
||
1209 | * Get cell at a specific coordinate by using numeric cell coordinates |
||
1210 | * |
||
1211 | * @param string $pColumn Numeric column coordinate of the cell |
||
1212 | * @param string $pRow Numeric row coordinate of the cell |
||
1213 | * @param bool $createIfNotExists Flag indicating whether a new cell should be created if it doesn't |
||
1214 | * already exist, or a null should be returned instead |
||
1215 | * @return null|Cell Cell that was found/created or null |
||
1216 | */ |
||
1217 | 29 | public function getCellByColumnAndRow($pColumn = 0, $pRow = 1, $createIfNotExists = true) |
|
1229 | |||
1230 | /** |
||
1231 | * Create a new cell at the specified coordinate |
||
1232 | * |
||
1233 | * @param string $pCoordinate Coordinate of the cell |
||
1234 | * @return Cell Cell that was created |
||
1235 | */ |
||
1236 | 62 | private function createNewCell($pCoordinate) |
|
1266 | |||
1267 | /** |
||
1268 | * Does the cell at a specific coordinate exist? |
||
1269 | * |
||
1270 | * @param string $pCoordinate Coordinate of the cell |
||
1271 | * @throws Exception |
||
1272 | * @return bool |
||
1273 | */ |
||
1274 | 37 | public function cellExists($pCoordinate = 'A1') |
|
1316 | |||
1317 | /** |
||
1318 | * Cell at a specific coordinate by using numeric cell coordinates exists? |
||
1319 | * |
||
1320 | * @param string $pColumn Numeric column coordinate of the cell |
||
1321 | * @param string $pRow Numeric row coordinate of the cell |
||
1322 | * @return bool |
||
1323 | */ |
||
1324 | 3 | public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 1) |
|
1328 | |||
1329 | /** |
||
1330 | * Get row dimension at a specific row |
||
1331 | * |
||
1332 | * @param int $pRow Numeric index of the row |
||
1333 | * @return Worksheet\RowDimension |
||
1334 | */ |
||
1335 | 62 | public function getRowDimension($pRow = 1, $create = true) |
|
1352 | |||
1353 | /** |
||
1354 | * Get column dimension at a specific column |
||
1355 | * |
||
1356 | * @param string $pColumn String index of the column |
||
1357 | * @return Worksheet\ColumnDimension |
||
1358 | */ |
||
1359 | 62 | public function getColumnDimension($pColumn = 'A', $create = true) |
|
1378 | |||
1379 | /** |
||
1380 | * Get column dimension at a specific column by using numeric cell coordinates |
||
1381 | * |
||
1382 | * @param int $pColumn Numeric column coordinate of the cell |
||
1383 | * @return Worksheet\ColumnDimension |
||
1384 | */ |
||
1385 | 3 | public function getColumnDimensionByColumn($pColumn = 0) |
|
1389 | |||
1390 | /** |
||
1391 | * Get styles |
||
1392 | * |
||
1393 | * @return Style[] |
||
1394 | */ |
||
1395 | public function getStyles() |
||
1399 | |||
1400 | /** |
||
1401 | * Get default style of workbook. |
||
1402 | * |
||
1403 | * @deprecated |
||
1404 | * @throws Exception |
||
1405 | * @return Style |
||
1406 | */ |
||
1407 | public function getDefaultStyle() |
||
1411 | |||
1412 | /** |
||
1413 | * Set default style - should only be used by \PhpOffice\PhpSpreadsheet\IReader implementations! |
||
1414 | * |
||
1415 | * @deprecated |
||
1416 | * @param Style $pValue |
||
1417 | * @throws Exception |
||
1418 | * @return Worksheet |
||
1419 | */ |
||
1420 | public function setDefaultStyle(Style $pValue) |
||
1431 | |||
1432 | /** |
||
1433 | * Get style for cell |
||
1434 | * |
||
1435 | * @param string $pCellCoordinate Cell coordinate (or range) to get style for |
||
1436 | * @throws Exception |
||
1437 | * @return Style |
||
1438 | */ |
||
1439 | 29 | public function getStyle($pCellCoordinate = 'A1') |
|
1449 | |||
1450 | /** |
||
1451 | * Get conditional styles for a cell |
||
1452 | * |
||
1453 | * @param string $pCoordinate |
||
1454 | * @return Style\Conditional[] |
||
1455 | */ |
||
1456 | 2 | public function getConditionalStyles($pCoordinate = 'A1') |
|
1465 | |||
1466 | /** |
||
1467 | * Do conditional styles exist for this cell? |
||
1468 | * |
||
1469 | * @param string $pCoordinate |
||
1470 | * @return bool |
||
1471 | */ |
||
1472 | 10 | public function conditionalStylesExists($pCoordinate = 'A1') |
|
1480 | |||
1481 | /** |
||
1482 | * Removes conditional styles for a cell |
||
1483 | * |
||
1484 | * @param string $pCoordinate |
||
1485 | * @return Worksheet |
||
1486 | */ |
||
1487 | 11 | public function removeConditionalStyles($pCoordinate = 'A1') |
|
1493 | |||
1494 | /** |
||
1495 | * Get collection of conditional styles |
||
1496 | * |
||
1497 | * @return array |
||
1498 | */ |
||
1499 | 58 | public function getConditionalStylesCollection() |
|
1503 | |||
1504 | /** |
||
1505 | * Set conditional styles |
||
1506 | * |
||
1507 | * @param string $pCoordinate eg: 'A1' |
||
1508 | * @param $pValue Style\Conditional[] |
||
1509 | * @return Worksheet |
||
1510 | */ |
||
1511 | 2 | public function setConditionalStyles($pCoordinate, $pValue) |
|
1517 | |||
1518 | /** |
||
1519 | * Get style for cell by using numeric cell coordinates |
||
1520 | * |
||
1521 | * @param int $pColumn Numeric column coordinate of the cell |
||
1522 | * @param int $pRow Numeric row coordinate of the cell |
||
1523 | * @param int pColumn2 Numeric column coordinate of the range cell |
||
1524 | * @param int pRow2 Numeric row coordinate of the range cell |
||
1525 | * @return Style |
||
1526 | */ |
||
1527 | public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1, $pColumn2 = null, $pRow2 = null) |
||
1537 | |||
1538 | /** |
||
1539 | * Set shared cell style to a range of cells |
||
1540 | * |
||
1541 | * Please note that this will overwrite existing cell styles for cells in range! |
||
1542 | * |
||
1543 | * @deprecated duplicateStyle |
||
1544 | * @param Style $pSharedCellStyle Cell style to share |
||
1545 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
1546 | * @throws Exception |
||
1547 | * @return Worksheet |
||
1548 | */ |
||
1549 | public function setSharedStyle(Style $pSharedCellStyle = null, $pRange = '') |
||
1555 | |||
1556 | /** |
||
1557 | * Duplicate cell style to a range of cells |
||
1558 | * |
||
1559 | * Please note that this will overwrite existing cell styles for cells in range! |
||
1560 | * |
||
1561 | * @param Style $pCellStyle Cell style to duplicate |
||
1562 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
1563 | * @throws Exception |
||
1564 | * @return Worksheet |
||
1565 | */ |
||
1566 | 2 | public function duplicateStyle(Style $pCellStyle = null, $pRange = '') |
|
1601 | |||
1602 | /** |
||
1603 | * Duplicate conditional style to a range of cells |
||
1604 | * |
||
1605 | * Please note that this will overwrite existing cell styles for cells in range! |
||
1606 | * |
||
1607 | * @param Style\Conditional[] $pCellStyle Cell style to duplicate |
||
1608 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
1609 | * @throws Exception |
||
1610 | * @return Worksheet |
||
1611 | */ |
||
1612 | 2 | public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '') |
|
1639 | |||
1640 | /** |
||
1641 | * Duplicate cell style array to a range of cells |
||
1642 | * |
||
1643 | * Please note that this will overwrite existing cell styles for cells in range, |
||
1644 | * if they are in the styles array. For example, if you decide to set a range of |
||
1645 | * cells to font bold, only include font bold in the styles array. |
||
1646 | * |
||
1647 | * @deprecated |
||
1648 | * @param array $pStyles Array containing style information |
||
1649 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
1650 | * @param bool $pAdvanced Advanced mode for setting borders. |
||
1651 | * @throws Exception |
||
1652 | * @return Worksheet |
||
1653 | */ |
||
1654 | public function duplicateStyleArray($pStyles = null, $pRange = '', $pAdvanced = true) |
||
1660 | |||
1661 | /** |
||
1662 | * Set break on a cell |
||
1663 | * |
||
1664 | * @param string $pCell Cell coordinate (e.g. A1) |
||
1665 | * @param int $pBreak Break type (type of Worksheet::BREAK_*) |
||
1666 | * @throws Exception |
||
1667 | * @return Worksheet |
||
1668 | */ |
||
1669 | 1 | public function setBreak($pCell = 'A1', $pBreak = self::BREAK_NONE) |
|
1688 | |||
1689 | /** |
||
1690 | * Set break on a cell by using numeric cell coordinates |
||
1691 | * |
||
1692 | * @param int $pColumn Numeric column coordinate of the cell |
||
1693 | * @param int $pRow Numeric row coordinate of the cell |
||
1694 | * @param int $pBreak Break type (type of \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_*) |
||
1695 | * @return Worksheet |
||
1696 | */ |
||
1697 | public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = self::BREAK_NONE) |
||
1701 | |||
1702 | /** |
||
1703 | * Get breaks |
||
1704 | * |
||
1705 | * @return array[] |
||
1706 | */ |
||
1707 | 59 | public function getBreaks() |
|
1711 | |||
1712 | /** |
||
1713 | * Set merge on a cell range |
||
1714 | * |
||
1715 | * @param string $pRange Cell range (e.g. A1:E1) |
||
1716 | * @throws Exception |
||
1717 | * @return Worksheet |
||
1718 | */ |
||
1719 | 15 | public function mergeCells($pRange = 'A1:A1') |
|
1751 | |||
1752 | /** |
||
1753 | * Set merge on a cell range by using numeric cell coordinates |
||
1754 | * |
||
1755 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1756 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1757 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1758 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1759 | * @throws Exception |
||
1760 | * @return Worksheet |
||
1761 | */ |
||
1762 | public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) |
||
1768 | |||
1769 | /** |
||
1770 | * Remove merge on a cell range |
||
1771 | * |
||
1772 | * @param string $pRange Cell range (e.g. A1:E1) |
||
1773 | * @throws Exception |
||
1774 | * @return Worksheet |
||
1775 | */ |
||
1776 | 9 | public function unmergeCells($pRange = 'A1:A1') |
|
1793 | |||
1794 | /** |
||
1795 | * Remove merge on a cell range by using numeric cell coordinates |
||
1796 | * |
||
1797 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1798 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1799 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1800 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1801 | * @throws Exception |
||
1802 | * @return Worksheet |
||
1803 | */ |
||
1804 | public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) |
||
1810 | |||
1811 | /** |
||
1812 | * Get merge cells array. |
||
1813 | * |
||
1814 | * @return array[] |
||
1815 | */ |
||
1816 | 59 | public function getMergeCells() |
|
1820 | |||
1821 | /** |
||
1822 | * Set merge cells array for the entire sheet. Use instead mergeCells() to merge |
||
1823 | * a single cell range. |
||
1824 | * |
||
1825 | * @param array |
||
1826 | */ |
||
1827 | 12 | public function setMergeCells($pValue = []) |
|
1833 | |||
1834 | /** |
||
1835 | * Set protection on a cell range |
||
1836 | * |
||
1837 | * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) |
||
1838 | * @param string $pPassword Password to unlock the protection |
||
1839 | * @param bool $pAlreadyHashed If the password has already been hashed, set this to true |
||
1840 | * @throws Exception |
||
1841 | * @return Worksheet |
||
1842 | */ |
||
1843 | 9 | public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false) |
|
1855 | |||
1856 | /** |
||
1857 | * Set protection on a cell range by using numeric cell coordinates |
||
1858 | * |
||
1859 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1860 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1861 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1862 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1863 | * @param string $pPassword Password to unlock the protection |
||
1864 | * @param bool $pAlreadyHashed If the password has already been hashed, set this to true |
||
1865 | * @throws Exception |
||
1866 | * @return Worksheet |
||
1867 | */ |
||
1868 | public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) |
||
1874 | |||
1875 | /** |
||
1876 | * Remove protection on a cell range |
||
1877 | * |
||
1878 | * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) |
||
1879 | * @throws Exception |
||
1880 | * @return Worksheet |
||
1881 | */ |
||
1882 | 9 | public function unprotectCells($pRange = 'A1') |
|
1895 | |||
1896 | /** |
||
1897 | * Remove protection on a cell range by using numeric cell coordinates |
||
1898 | * |
||
1899 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1900 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1901 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1902 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1903 | * @param string $pPassword Password to unlock the protection |
||
1904 | * @param bool $pAlreadyHashed If the password has already been hashed, set this to true |
||
1905 | * @throws Exception |
||
1906 | * @return Worksheet |
||
1907 | */ |
||
1908 | public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) |
||
1914 | |||
1915 | /** |
||
1916 | * Get protected cells |
||
1917 | * |
||
1918 | * @return array[] |
||
1919 | */ |
||
1920 | 59 | public function getProtectedCells() |
|
1924 | |||
1925 | /** |
||
1926 | * Get Autofilter |
||
1927 | * |
||
1928 | * @return Worksheet\AutoFilter |
||
1929 | */ |
||
1930 | 60 | public function getAutoFilter() |
|
1934 | |||
1935 | /** |
||
1936 | * Set AutoFilter |
||
1937 | * |
||
1938 | * @param Worksheet\AutoFilter|string $pValue |
||
1939 | * A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility |
||
1940 | * @throws Exception |
||
1941 | * @return Worksheet |
||
1942 | */ |
||
1943 | 4 | public function setAutoFilter($pValue) |
|
1954 | |||
1955 | /** |
||
1956 | * Set Autofilter Range by using numeric cell coordinates |
||
1957 | * |
||
1958 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1959 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1960 | * @param int $pColumn2 Numeric column coordinate of the second cell |
||
1961 | * @param int $pRow2 Numeric row coordinate of the second cell |
||
1962 | * @throws Exception |
||
1963 | * @return Worksheet |
||
1964 | */ |
||
1965 | public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) |
||
1973 | |||
1974 | /** |
||
1975 | * Remove autofilter |
||
1976 | * |
||
1977 | * @return Worksheet |
||
1978 | */ |
||
1979 | public function removeAutoFilter() |
||
1985 | |||
1986 | /** |
||
1987 | * Get Freeze Pane |
||
1988 | * |
||
1989 | * @return string |
||
1990 | */ |
||
1991 | 59 | public function getFreezePane() |
|
1995 | |||
1996 | /** |
||
1997 | * Freeze Pane |
||
1998 | * |
||
1999 | * @param string $pCell Cell (i.e. A2) |
||
2000 | * Examples: |
||
2001 | * A2 will freeze the rows above cell A2 (i.e row 1) |
||
2002 | * B1 will freeze the columns to the left of cell B1 (i.e column A) |
||
2003 | * B2 will freeze the rows above and to the left of cell A2 |
||
2004 | * (i.e row 1 and column A) |
||
2005 | * @throws Exception |
||
2006 | * @return Worksheet |
||
2007 | */ |
||
2008 | 4 | public function freezePane($pCell = '') |
|
2020 | |||
2021 | /** |
||
2022 | * Freeze Pane by using numeric cell coordinates |
||
2023 | * |
||
2024 | * @param int $pColumn Numeric column coordinate of the cell |
||
2025 | * @param int $pRow Numeric row coordinate of the cell |
||
2026 | * @throws Exception |
||
2027 | * @return Worksheet |
||
2028 | */ |
||
2029 | public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 1) |
||
2033 | |||
2034 | /** |
||
2035 | * Unfreeze Pane |
||
2036 | * |
||
2037 | * @return Worksheet |
||
2038 | */ |
||
2039 | public function unfreezePane() |
||
2043 | |||
2044 | /** |
||
2045 | * Insert a new row, updating all possible related data |
||
2046 | * |
||
2047 | * @param int $pBefore Insert before this one |
||
2048 | * @param int $pNumRows Number of rows to insert |
||
2049 | * @throws Exception |
||
2050 | * @return Worksheet |
||
2051 | */ |
||
2052 | 10 | View Code Duplication | public function insertNewRowBefore($pBefore = 1, $pNumRows = 1) |
2063 | |||
2064 | /** |
||
2065 | * Insert a new column, updating all possible related data |
||
2066 | * |
||
2067 | * @param int $pBefore Insert before this one |
||
2068 | * @param int $pNumCols Number of columns to insert |
||
2069 | * @throws Exception |
||
2070 | * @return Worksheet |
||
2071 | */ |
||
2072 | 9 | View Code Duplication | public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1) |
2083 | |||
2084 | /** |
||
2085 | * Insert a new column, updating all possible related data |
||
2086 | * |
||
2087 | * @param int $pBefore Insert before this one (numeric column coordinate of the cell) |
||
2088 | * @param int $pNumCols Number of columns to insert |
||
2089 | * @throws Exception |
||
2090 | * @return Worksheet |
||
2091 | */ |
||
2092 | public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1) |
||
2100 | |||
2101 | /** |
||
2102 | * Delete a row, updating all possible related data |
||
2103 | * |
||
2104 | * @param int $pRow Remove starting with this one |
||
2105 | * @param int $pNumRows Number of rows to remove |
||
2106 | * @throws Exception |
||
2107 | * @return Worksheet |
||
2108 | */ |
||
2109 | 12 | public function removeRow($pRow = 1, $pNumRows = 1) |
|
2125 | |||
2126 | /** |
||
2127 | * Remove a column, updating all possible related data |
||
2128 | * |
||
2129 | * @param string $pColumn Remove starting with this one |
||
2130 | * @param int $pNumCols Number of columns to remove |
||
2131 | * @throws Exception |
||
2132 | * @return Worksheet |
||
2133 | */ |
||
2134 | 9 | public function removeColumn($pColumn = 'A', $pNumCols = 1) |
|
2151 | |||
2152 | /** |
||
2153 | * Remove a column, updating all possible related data |
||
2154 | * |
||
2155 | * @param int $pColumn Remove starting with this one (numeric column coordinate of the cell) |
||
2156 | * @param int $pNumCols Number of columns to remove |
||
2157 | * @throws Exception |
||
2158 | * @return Worksheet |
||
2159 | */ |
||
2160 | public function removeColumnByIndex($pColumn = 0, $pNumCols = 1) |
||
2168 | |||
2169 | /** |
||
2170 | * Show gridlines? |
||
2171 | * |
||
2172 | * @return bool |
||
2173 | */ |
||
2174 | 59 | public function getShowGridlines() |
|
2178 | |||
2179 | /** |
||
2180 | * Set show gridlines |
||
2181 | * |
||
2182 | * @param bool $pValue Show gridlines (true/false) |
||
2183 | * @return Worksheet |
||
2184 | */ |
||
2185 | 9 | public function setShowGridlines($pValue = false) |
|
2191 | |||
2192 | /** |
||
2193 | * Print gridlines? |
||
2194 | * |
||
2195 | * @return bool |
||
2196 | */ |
||
2197 | 58 | public function getPrintGridlines() |
|
2201 | |||
2202 | /** |
||
2203 | * Set print gridlines |
||
2204 | * |
||
2205 | * @param bool $pValue Print gridlines (true/false) |
||
2206 | * @return Worksheet |
||
2207 | */ |
||
2208 | 4 | public function setPrintGridlines($pValue = false) |
|
2214 | |||
2215 | /** |
||
2216 | * Show row and column headers? |
||
2217 | * |
||
2218 | * @return bool |
||
2219 | */ |
||
2220 | 58 | public function getShowRowColHeaders() |
|
2224 | |||
2225 | /** |
||
2226 | * Set show row and column headers |
||
2227 | * |
||
2228 | * @param bool $pValue Show row and column headers (true/false) |
||
2229 | * @return Worksheet |
||
2230 | */ |
||
2231 | 9 | public function setShowRowColHeaders($pValue = false) |
|
2237 | |||
2238 | /** |
||
2239 | * Show summary below? (Row/Column outlining) |
||
2240 | * |
||
2241 | * @return bool |
||
2242 | */ |
||
2243 | 58 | public function getShowSummaryBelow() |
|
2247 | |||
2248 | /** |
||
2249 | * Set show summary below |
||
2250 | * |
||
2251 | * @param bool $pValue Show summary below (true/false) |
||
2252 | * @return Worksheet |
||
2253 | */ |
||
2254 | 9 | public function setShowSummaryBelow($pValue = true) |
|
2260 | |||
2261 | /** |
||
2262 | * Show summary right? (Row/Column outlining) |
||
2263 | * |
||
2264 | * @return bool |
||
2265 | */ |
||
2266 | 58 | public function getShowSummaryRight() |
|
2270 | |||
2271 | /** |
||
2272 | * Set show summary right |
||
2273 | * |
||
2274 | * @param bool $pValue Show summary right (true/false) |
||
2275 | * @return Worksheet |
||
2276 | */ |
||
2277 | 9 | public function setShowSummaryRight($pValue = true) |
|
2283 | |||
2284 | /** |
||
2285 | * Get comments |
||
2286 | * |
||
2287 | * @return Comment[] |
||
2288 | */ |
||
2289 | 58 | public function getComments() |
|
2293 | |||
2294 | /** |
||
2295 | * Set comments array for the entire sheet. |
||
2296 | * |
||
2297 | * @param array of Comment |
||
2298 | * @return Worksheet |
||
2299 | */ |
||
2300 | 12 | public function setComments($pValue = []) |
|
2306 | |||
2307 | /** |
||
2308 | * Get comment for cell |
||
2309 | * |
||
2310 | * @param string $pCellCoordinate Cell coordinate to get comment for |
||
2311 | * @throws Exception |
||
2312 | * @return Comment |
||
2313 | */ |
||
2314 | 13 | public function getComment($pCellCoordinate = 'A1') |
|
2338 | |||
2339 | /** |
||
2340 | * Get comment for cell by using numeric cell coordinates |
||
2341 | * |
||
2342 | * @param int $pColumn Numeric column coordinate of the cell |
||
2343 | * @param int $pRow Numeric row coordinate of the cell |
||
2344 | * @return Comment |
||
2345 | */ |
||
2346 | 2 | public function getCommentByColumnAndRow($pColumn = 0, $pRow = 1) |
|
2350 | |||
2351 | /** |
||
2352 | * Get selected cell |
||
2353 | * |
||
2354 | * @deprecated |
||
2355 | * @return string |
||
2356 | */ |
||
2357 | public function getSelectedCell() |
||
2361 | |||
2362 | /** |
||
2363 | * Get active cell |
||
2364 | * |
||
2365 | * @return string Example: 'A1' |
||
2366 | */ |
||
2367 | 57 | public function getActiveCell() |
|
2371 | |||
2372 | /** |
||
2373 | * Get selected cells |
||
2374 | * |
||
2375 | * @return string |
||
2376 | */ |
||
2377 | 45 | public function getSelectedCells() |
|
2381 | |||
2382 | /** |
||
2383 | * Selected cell |
||
2384 | * |
||
2385 | * @param string $pCoordinate Cell (i.e. A1) |
||
2386 | * @return Worksheet |
||
2387 | */ |
||
2388 | public function setSelectedCell($pCoordinate = 'A1') |
||
2392 | |||
2393 | /** |
||
2394 | * Select a range of cells. |
||
2395 | * |
||
2396 | * @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6' |
||
2397 | * @throws Exception |
||
2398 | * @return Worksheet |
||
2399 | */ |
||
2400 | 38 | public function setSelectedCells($pCoordinate = 'A1') |
|
2427 | |||
2428 | /** |
||
2429 | * Selected cell by using numeric cell coordinates |
||
2430 | * |
||
2431 | * @param int $pColumn Numeric column coordinate of the cell |
||
2432 | * @param int $pRow Numeric row coordinate of the cell |
||
2433 | * @throws Exception |
||
2434 | * @return Worksheet |
||
2435 | */ |
||
2436 | public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 1) |
||
2440 | |||
2441 | /** |
||
2442 | * Get right-to-left |
||
2443 | * |
||
2444 | * @return bool |
||
2445 | */ |
||
2446 | 58 | public function getRightToLeft() |
|
2450 | |||
2451 | /** |
||
2452 | * Set right-to-left |
||
2453 | * |
||
2454 | * @param bool $value Right-to-left true/false |
||
2455 | * @return Worksheet |
||
2456 | */ |
||
2457 | 4 | public function setRightToLeft($value = false) |
|
2463 | |||
2464 | /** |
||
2465 | * Fill worksheet from values in array |
||
2466 | * |
||
2467 | * @param array $source Source array |
||
2468 | * @param mixed $nullValue Value in source array that stands for blank cell |
||
2469 | * @param string $startCell Insert array starting from this cell address as the top left coordinate |
||
2470 | * @param bool $strictNullComparison Apply strict comparison when testing for null values in the array |
||
2471 | * @throws Exception |
||
2472 | * @return Worksheet |
||
2473 | */ |
||
2474 | 17 | public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) |
|
2510 | |||
2511 | /** |
||
2512 | * Create array from a range of cells |
||
2513 | * |
||
2514 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
2515 | * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist |
||
2516 | * @param bool $calculateFormulas Should formulas be calculated? |
||
2517 | * @param bool $formatData Should formatting be applied to cell values? |
||
2518 | * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero |
||
2519 | * True - Return rows and columns indexed by their actual row and column IDs |
||
2520 | * @return array |
||
2521 | */ |
||
2522 | 2 | public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) |
|
2579 | |||
2580 | /** |
||
2581 | * Create array from a range of cells |
||
2582 | * |
||
2583 | * @param string $pNamedRange Name of the Named Range |
||
2584 | * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist |
||
2585 | * @param bool $calculateFormulas Should formulas be calculated? |
||
2586 | * @param bool $formatData Should formatting be applied to cell values? |
||
2587 | * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero |
||
2588 | * True - Return rows and columns indexed by their actual row and column IDs |
||
2589 | * @throws Exception |
||
2590 | * @return array |
||
2591 | */ |
||
2592 | public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) |
||
2604 | |||
2605 | /** |
||
2606 | * Create array from worksheet |
||
2607 | * |
||
2608 | * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist |
||
2609 | * @param bool $calculateFormulas Should formulas be calculated? |
||
2610 | * @param bool $formatData Should formatting be applied to cell values? |
||
2611 | * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero |
||
2612 | * True - Return rows and columns indexed by their actual row and column IDs |
||
2613 | * @return array |
||
2614 | */ |
||
2615 | public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) |
||
2626 | |||
2627 | /** |
||
2628 | * Get row iterator |
||
2629 | * |
||
2630 | * @param int $startRow The row number at which to start iterating |
||
2631 | * @param int $endRow The row number at which to stop iterating |
||
2632 | * |
||
2633 | * @return Worksheet\RowIterator |
||
2634 | */ |
||
2635 | 2 | public function getRowIterator($startRow = 1, $endRow = null) |
|
2639 | |||
2640 | /** |
||
2641 | * Get column iterator |
||
2642 | * |
||
2643 | * @param string $startColumn The column address at which to start iterating |
||
2644 | * @param string $endColumn The column address at which to stop iterating |
||
2645 | * |
||
2646 | * @return Worksheet\ColumnIterator |
||
2647 | */ |
||
2648 | public function getColumnIterator($startColumn = 'A', $endColumn = null) |
||
2652 | |||
2653 | /** |
||
2654 | * Run PhpSpreadsheet garabage collector. |
||
2655 | * |
||
2656 | * @return Worksheet |
||
2657 | */ |
||
2658 | 59 | public function garbageCollect() |
|
2689 | |||
2690 | /** |
||
2691 | * Get hash code |
||
2692 | * |
||
2693 | * @return string Hash code |
||
2694 | */ |
||
2695 | 60 | public function getHashCode() |
|
2704 | |||
2705 | /** |
||
2706 | * Extract worksheet title from range. |
||
2707 | * |
||
2708 | * Example: extractSheetTitle("testSheet!A1") ==> 'A1' |
||
2709 | * Example: extractSheetTitle("'testSheet 1'!A1", true) ==> array('testSheet 1', 'A1'); |
||
2710 | * |
||
2711 | * @param string $pRange Range to extract title from |
||
2712 | * @param bool $returnRange Return range? (see example) |
||
2713 | * @return mixed |
||
2714 | */ |
||
2715 | 1 | public static function extractSheetTitle($pRange, $returnRange = false) |
|
2728 | |||
2729 | /** |
||
2730 | * Get hyperlink |
||
2731 | * |
||
2732 | * @param string $pCellCoordinate Cell coordinate to get hyperlink for |
||
2733 | */ |
||
2734 | 11 | View Code Duplication | public function getHyperlink($pCellCoordinate = 'A1') |
2746 | |||
2747 | /** |
||
2748 | * Set hyperlnk |
||
2749 | * |
||
2750 | * @param string $pCellCoordinate Cell coordinate to insert hyperlink |
||
2751 | * @param Cell\Hyperlink $pHyperlink |
||
2752 | * @return Worksheet |
||
2753 | */ |
||
2754 | 10 | public function setHyperlink($pCellCoordinate = 'A1', Cell\Hyperlink $pHyperlink = null) |
|
2764 | |||
2765 | /** |
||
2766 | * Hyperlink at a specific coordinate exists? |
||
2767 | * |
||
2768 | * @param string $pCoordinate |
||
2769 | * @return bool |
||
2770 | */ |
||
2771 | 3 | public function hyperlinkExists($pCoordinate = 'A1') |
|
2775 | |||
2776 | /** |
||
2777 | * Get collection of hyperlinks |
||
2778 | * |
||
2779 | * @return Cell\Hyperlink[] |
||
2780 | */ |
||
2781 | 59 | public function getHyperlinkCollection() |
|
2785 | |||
2786 | /** |
||
2787 | * Get data validation |
||
2788 | * |
||
2789 | * @param string $pCellCoordinate Cell coordinate to get data validation for |
||
2790 | */ |
||
2791 | 2 | View Code Duplication | public function getDataValidation($pCellCoordinate = 'A1') |
2803 | |||
2804 | /** |
||
2805 | * Set data validation |
||
2806 | * |
||
2807 | * @param string $pCellCoordinate Cell coordinate to insert data validation |
||
2808 | * @param Cell\DataValidation $pDataValidation |
||
2809 | * @return Worksheet |
||
2810 | */ |
||
2811 | public function setDataValidation($pCellCoordinate = 'A1', Cell\DataValidation $pDataValidation = null) |
||
2821 | |||
2822 | /** |
||
2823 | * Data validation at a specific coordinate exists? |
||
2824 | * |
||
2825 | * @param string $pCoordinate |
||
2826 | * @return bool |
||
2827 | */ |
||
2828 | public function dataValidationExists($pCoordinate = 'A1') |
||
2832 | |||
2833 | /** |
||
2834 | * Get collection of data validations |
||
2835 | * |
||
2836 | * @return Cell\DataValidation[] |
||
2837 | */ |
||
2838 | 59 | public function getDataValidationCollection() |
|
2842 | |||
2843 | /** |
||
2844 | * Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet |
||
2845 | * |
||
2846 | * @param string $range |
||
2847 | * @return string Adjusted range value |
||
2848 | */ |
||
2849 | public function shrinkRangeToFit($range) |
||
2878 | |||
2879 | /** |
||
2880 | * Get tab color |
||
2881 | * |
||
2882 | * @return Style\Color |
||
2883 | */ |
||
2884 | 9 | public function getTabColor() |
|
2892 | |||
2893 | /** |
||
2894 | * Reset tab color |
||
2895 | * |
||
2896 | * @return Worksheet |
||
2897 | */ |
||
2898 | public function resetTabColor() |
||
2905 | |||
2906 | /** |
||
2907 | * Tab color set? |
||
2908 | * |
||
2909 | * @return bool |
||
2910 | */ |
||
2911 | 58 | public function isTabColorSet() |
|
2915 | |||
2916 | /** |
||
2917 | * Copy worksheet (!= clone!) |
||
2918 | * |
||
2919 | * @return Worksheet |
||
2920 | */ |
||
2921 | public function copy() |
||
2927 | |||
2928 | /** |
||
2929 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
||
2930 | */ |
||
2931 | 1 | public function __clone() |
|
2956 | /** |
||
2957 | * Define the code name of the sheet |
||
2958 | * |
||
2959 | * @param null|string Same rule as Title minus space not allowed (but, like Excel, change silently space to underscore) |
||
2960 | * @throws Exception |
||
2961 | * @return objWorksheet |
||
2962 | */ |
||
2963 | 70 | public function setCodeName($pValue = null) |
|
3008 | /** |
||
3009 | * Return the code name of the sheet |
||
3010 | * |
||
3011 | * @return null|string |
||
3012 | */ |
||
3013 | 70 | public function getCodeName() |
|
3017 | /** |
||
3018 | * Sheet has a code name ? |
||
3019 | * @return bool |
||
3020 | */ |
||
3021 | public function hasCodeName() |
||
3025 | } |
||
3026 |
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..