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 |
||
29 | class Worksheet implements IComparable |
||
30 | { |
||
31 | /* Break types */ |
||
32 | const BREAK_NONE = 0; |
||
33 | const BREAK_ROW = 1; |
||
34 | const BREAK_COLUMN = 2; |
||
35 | |||
36 | /* Sheet state */ |
||
37 | const SHEETSTATE_VISIBLE = 'visible'; |
||
38 | const SHEETSTATE_HIDDEN = 'hidden'; |
||
39 | const SHEETSTATE_VERYHIDDEN = 'veryHidden'; |
||
40 | |||
41 | /** |
||
42 | * Invalid characters in sheet title |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | private static $invalidCharacters = array('*', ':', '/', '\\', '?', '[', ']'); |
||
47 | |||
48 | /** |
||
49 | * Parent spreadsheet |
||
50 | * |
||
51 | * @var Spreadsheet |
||
52 | */ |
||
53 | private $parent; |
||
54 | |||
55 | /** |
||
56 | * Cacheable collection of cells |
||
57 | * |
||
58 | * @var CachedObjectStorage_xxx |
||
59 | */ |
||
60 | private $cellCollection; |
||
61 | |||
62 | /** |
||
63 | * Collection of row dimensions |
||
64 | * |
||
65 | * @var Worksheet\RowDimension[] |
||
66 | */ |
||
67 | private $rowDimensions = array(); |
||
68 | |||
69 | /** |
||
70 | * Default row dimension |
||
71 | * |
||
72 | * @var Worksheet\RowDimension |
||
73 | */ |
||
74 | private $defaultRowDimension; |
||
75 | |||
76 | /** |
||
77 | * Collection of column dimensions |
||
78 | * |
||
79 | * @var Worksheet\ColumnDimension[] |
||
80 | */ |
||
81 | private $columnDimensions = array(); |
||
82 | |||
83 | /** |
||
84 | * Default column dimension |
||
85 | * |
||
86 | * @var Worksheet\ColumnDimension |
||
87 | */ |
||
88 | private $defaultColumnDimension = null; |
||
89 | |||
90 | /** |
||
91 | * Collection of drawings |
||
92 | * |
||
93 | * @var Worksheet\BaseDrawing[] |
||
94 | */ |
||
95 | private $drawingCollection = null; |
||
96 | |||
97 | /** |
||
98 | * Collection of Chart objects |
||
99 | * |
||
100 | * @var Chart[] |
||
101 | */ |
||
102 | private $chartCollection = array(); |
||
103 | |||
104 | /** |
||
105 | * Worksheet title |
||
106 | * |
||
107 | * @var string |
||
108 | */ |
||
109 | private $title; |
||
110 | |||
111 | /** |
||
112 | * Sheet state |
||
113 | * |
||
114 | * @var string |
||
115 | */ |
||
116 | private $sheetState; |
||
117 | |||
118 | /** |
||
119 | * Page setup |
||
120 | * |
||
121 | * @var Worksheet\PageSetup |
||
122 | */ |
||
123 | private $pageSetup; |
||
124 | |||
125 | /** |
||
126 | * Page margins |
||
127 | * |
||
128 | * @var Worksheet\PageMargins |
||
129 | */ |
||
130 | private $pageMargins; |
||
131 | |||
132 | /** |
||
133 | * Page header/footer |
||
134 | * |
||
135 | * @var Worksheet\HeaderFooter |
||
136 | */ |
||
137 | private $headerFooter; |
||
138 | |||
139 | /** |
||
140 | * Sheet view |
||
141 | * |
||
142 | * @var Worksheet\SheetView |
||
143 | */ |
||
144 | private $sheetView; |
||
145 | |||
146 | /** |
||
147 | * Protection |
||
148 | * |
||
149 | * @var Worksheet\Protection |
||
150 | */ |
||
151 | private $protection; |
||
152 | |||
153 | /** |
||
154 | * Collection of styles |
||
155 | * |
||
156 | * @var Style[] |
||
157 | */ |
||
158 | private $styles = array(); |
||
159 | |||
160 | /** |
||
161 | * Conditional styles. Indexed by cell coordinate, e.g. 'A1' |
||
162 | * |
||
163 | * @var array |
||
164 | */ |
||
165 | private $conditionalStylesCollection = array(); |
||
166 | |||
167 | /** |
||
168 | * Is the current cell collection sorted already? |
||
169 | * |
||
170 | * @var boolean |
||
171 | */ |
||
172 | private $cellCollectionIsSorted = false; |
||
173 | |||
174 | /** |
||
175 | * Collection of breaks |
||
176 | * |
||
177 | * @var array |
||
178 | */ |
||
179 | private $breaks = array(); |
||
180 | |||
181 | /** |
||
182 | * Collection of merged cell ranges |
||
183 | * |
||
184 | * @var array |
||
185 | */ |
||
186 | private $mergeCells = array(); |
||
187 | |||
188 | /** |
||
189 | * Collection of protected cell ranges |
||
190 | * |
||
191 | * @var array |
||
192 | */ |
||
193 | private $protectedCells = array(); |
||
194 | |||
195 | /** |
||
196 | * Autofilter Range and selection |
||
197 | * |
||
198 | * @var Worksheet\AutoFilter |
||
199 | */ |
||
200 | private $autoFilter; |
||
201 | |||
202 | /** |
||
203 | * Freeze pane |
||
204 | * |
||
205 | * @var string |
||
206 | */ |
||
207 | private $freezePane = ''; |
||
208 | |||
209 | /** |
||
210 | * Show gridlines? |
||
211 | * |
||
212 | * @var boolean |
||
213 | */ |
||
214 | private $showGridlines = true; |
||
215 | |||
216 | /** |
||
217 | * Print gridlines? |
||
218 | * |
||
219 | * @var boolean |
||
220 | */ |
||
221 | private $printGridlines = false; |
||
222 | |||
223 | /** |
||
224 | * Show row and column headers? |
||
225 | * |
||
226 | * @var boolean |
||
227 | */ |
||
228 | private $showRowColHeaders = true; |
||
229 | |||
230 | /** |
||
231 | * Show summary below? (Row/Column outline) |
||
232 | * |
||
233 | * @var boolean |
||
234 | */ |
||
235 | private $showSummaryBelow = true; |
||
236 | |||
237 | /** |
||
238 | * Show summary right? (Row/Column outline) |
||
239 | * |
||
240 | * @var boolean |
||
241 | */ |
||
242 | private $showSummaryRight = true; |
||
243 | |||
244 | /** |
||
245 | * Collection of comments |
||
246 | * |
||
247 | * @var Comment[] |
||
248 | */ |
||
249 | private $comments = array(); |
||
250 | |||
251 | /** |
||
252 | * Active cell. (Only one!) |
||
253 | * |
||
254 | * @var string |
||
255 | */ |
||
256 | private $activeCell = 'A1'; |
||
257 | |||
258 | /** |
||
259 | * Selected cells |
||
260 | * |
||
261 | * @var string |
||
262 | */ |
||
263 | private $selectedCells = 'A1'; |
||
264 | |||
265 | /** |
||
266 | * Cached highest column |
||
267 | * |
||
268 | * @var string |
||
269 | */ |
||
270 | private $cachedHighestColumn = 'A'; |
||
271 | |||
272 | /** |
||
273 | * Cached highest row |
||
274 | * |
||
275 | * @var int |
||
276 | */ |
||
277 | private $cachedHighestRow = 1; |
||
278 | |||
279 | /** |
||
280 | * Right-to-left? |
||
281 | * |
||
282 | * @var boolean |
||
283 | */ |
||
284 | private $rightToLeft = false; |
||
285 | |||
286 | /** |
||
287 | * Hyperlinks. Indexed by cell coordinate, e.g. 'A1' |
||
288 | * |
||
289 | * @var array |
||
290 | */ |
||
291 | private $hyperlinkCollection = array(); |
||
292 | |||
293 | /** |
||
294 | * Data validation objects. Indexed by cell coordinate, e.g. 'A1' |
||
295 | * |
||
296 | * @var array |
||
297 | */ |
||
298 | private $dataValidationCollection = array(); |
||
299 | |||
300 | /** |
||
301 | * Tab color |
||
302 | * |
||
303 | * @var Style\Color |
||
304 | */ |
||
305 | private $tabColor; |
||
306 | |||
307 | /** |
||
308 | * Dirty flag |
||
309 | * |
||
310 | * @var boolean |
||
311 | */ |
||
312 | private $dirty = true; |
||
313 | |||
314 | /** |
||
315 | * Hash |
||
316 | * |
||
317 | * @var string |
||
318 | */ |
||
319 | private $hash; |
||
320 | |||
321 | /** |
||
322 | * CodeName |
||
323 | * |
||
324 | * @var string |
||
325 | */ |
||
326 | private $codeName = null; |
||
327 | |||
328 | /** |
||
329 | * Create a new worksheet |
||
330 | * |
||
331 | * @param Spreadsheet $Parent |
||
|
|||
332 | * @param string $pTitle |
||
333 | */ |
||
334 | public function __construct(Spreadsheet $parent = null, $pTitle = 'Worksheet') |
||
364 | |||
365 | |||
366 | /** |
||
367 | * Disconnect all cells from this Worksheet object, |
||
368 | * typically so that the worksheet object can be unset |
||
369 | * |
||
370 | */ |
||
371 | public function disconnectCells() |
||
380 | |||
381 | /** |
||
382 | * Code to execute when this worksheet is unset() |
||
383 | * |
||
384 | */ |
||
385 | public function __destruct() |
||
391 | |||
392 | /** |
||
393 | * Return the cache controller for the cell collection |
||
394 | * |
||
395 | * @return CachedObjectStorage_xxx |
||
396 | */ |
||
397 | public function getCellCacheController() |
||
401 | |||
402 | |||
403 | /** |
||
404 | * Get array of invalid characters for sheet title |
||
405 | * |
||
406 | * @return array |
||
407 | */ |
||
408 | public static function getInvalidCharacters() |
||
412 | |||
413 | /** |
||
414 | * Check sheet code name for valid Excel syntax |
||
415 | * |
||
416 | * @param string $pValue The string to check |
||
417 | * @return string The valid string |
||
418 | * @throws Exception |
||
419 | */ |
||
420 | private static function checkSheetCodeName($pValue) |
||
440 | |||
441 | /** |
||
442 | * Check sheet title for valid Excel syntax |
||
443 | * |
||
444 | * @param string $pValue The string to check |
||
445 | * @return string The valid string |
||
446 | * @throws Exception |
||
447 | */ |
||
448 | private static function checkSheetTitle($pValue) |
||
462 | |||
463 | /** |
||
464 | * Get collection of cells |
||
465 | * |
||
466 | * @param boolean $pSorted Also sort the cell collection? |
||
467 | * @return Cell[] |
||
468 | */ |
||
469 | public function getCellCollection($pSorted = true) |
||
480 | |||
481 | /** |
||
482 | * Sort collection of cells |
||
483 | * |
||
484 | * @return Worksheet |
||
485 | */ |
||
486 | public function sortCellCollection() |
||
493 | |||
494 | /** |
||
495 | * Get collection of row dimensions |
||
496 | * |
||
497 | * @return Worksheet\RowDimension[] |
||
498 | */ |
||
499 | public function getRowDimensions() |
||
503 | |||
504 | /** |
||
505 | * Get default row dimension |
||
506 | * |
||
507 | * @return Worksheet\RowDimension |
||
508 | */ |
||
509 | public function getDefaultRowDimension() |
||
513 | |||
514 | /** |
||
515 | * Get collection of column dimensions |
||
516 | * |
||
517 | * @return Worksheet\ColumnDimension[] |
||
518 | */ |
||
519 | public function getColumnDimensions() |
||
523 | |||
524 | /** |
||
525 | * Get default column dimension |
||
526 | * |
||
527 | * @return Worksheet\ColumnDimension |
||
528 | */ |
||
529 | public function getDefaultColumnDimension() |
||
533 | |||
534 | /** |
||
535 | * Get collection of drawings |
||
536 | * |
||
537 | * @return Worksheet\BaseDrawing[] |
||
538 | */ |
||
539 | public function getDrawingCollection() |
||
543 | |||
544 | /** |
||
545 | * Get collection of charts |
||
546 | * |
||
547 | * @return Chart[] |
||
548 | */ |
||
549 | public function getChartCollection() |
||
553 | |||
554 | /** |
||
555 | * Add chart |
||
556 | * |
||
557 | * @param Chart $pChart |
||
558 | * @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last) |
||
559 | * @return Chart |
||
560 | */ |
||
561 | public function addChart(Chart $pChart = null, $iChartIndex = null) |
||
573 | |||
574 | /** |
||
575 | * Return the count of charts on this worksheet |
||
576 | * |
||
577 | * @return int The number of charts |
||
578 | */ |
||
579 | public function getChartCount() |
||
583 | |||
584 | /** |
||
585 | * Get a chart by its index position |
||
586 | * |
||
587 | * @param string $index Chart index position |
||
588 | * @return false|Chart |
||
589 | * @throws Exception |
||
590 | */ |
||
591 | public function getChartByIndex($index = null) |
||
606 | |||
607 | /** |
||
608 | * Return an array of the names of charts on this worksheet |
||
609 | * |
||
610 | * @return string[] The names of charts |
||
611 | * @throws Exception |
||
612 | */ |
||
613 | public function getChartNames() |
||
621 | |||
622 | /** |
||
623 | * Get a chart by name |
||
624 | * |
||
625 | * @param string $chartName Chart name |
||
626 | * @return false|Chart |
||
627 | * @throws Exception |
||
628 | */ |
||
629 | public function getChartByName($chartName = '') |
||
642 | |||
643 | /** |
||
644 | * Refresh column dimensions |
||
645 | * |
||
646 | * @return Worksheet |
||
647 | */ |
||
648 | public function refreshColumnDimensions() |
||
661 | |||
662 | /** |
||
663 | * Refresh row dimensions |
||
664 | * |
||
665 | * @return Worksheet |
||
666 | */ |
||
667 | public function refreshRowDimensions() |
||
680 | |||
681 | /** |
||
682 | * Calculate worksheet dimension |
||
683 | * |
||
684 | * @return string String containing the dimension of this worksheet |
||
685 | */ |
||
686 | public function calculateWorksheetDimension() |
||
691 | |||
692 | /** |
||
693 | * Calculate worksheet data dimension |
||
694 | * |
||
695 | * @return string String containing the dimension of this worksheet that actually contain data |
||
696 | */ |
||
697 | public function calculateWorksheetDataDimension() |
||
702 | |||
703 | /** |
||
704 | * Calculate widths for auto-size columns |
||
705 | * |
||
706 | * @param boolean $calculateMergeCells Calculate merge cell width |
||
707 | * @return Worksheet; |
||
708 | */ |
||
709 | public function calculateColumnWidths($calculateMergeCells = false) |
||
766 | |||
767 | /** |
||
768 | * Get parent |
||
769 | * |
||
770 | * @return PhpSpreadsheet |
||
771 | */ |
||
772 | public function getParent() |
||
776 | |||
777 | /** |
||
778 | * Re-bind parent |
||
779 | * |
||
780 | * @param Spreadsheet $parent |
||
781 | * @return Worksheet |
||
782 | */ |
||
783 | public function rebindParent(Spreadsheet $parent) |
||
799 | |||
800 | /** |
||
801 | * Get title |
||
802 | * |
||
803 | * @return string |
||
804 | */ |
||
805 | public function getTitle() |
||
809 | |||
810 | /** |
||
811 | * Set title |
||
812 | * |
||
813 | * @param string $pValue String containing the dimension of this worksheet |
||
814 | * @param string $updateFormulaCellReferences boolean Flag indicating whether cell references in formulae should |
||
815 | * be updated to reflect the new sheet name. |
||
816 | * This should be left as the default true, unless you are |
||
817 | * certain that no formula cells on any worksheet contain |
||
818 | * references to this worksheet |
||
819 | * @return Worksheet |
||
820 | */ |
||
821 | public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true) |
||
877 | |||
878 | /** |
||
879 | * Get sheet state |
||
880 | * |
||
881 | * @return string Sheet state (visible, hidden, veryHidden) |
||
882 | */ |
||
883 | public function getSheetState() |
||
887 | |||
888 | /** |
||
889 | * Set sheet state |
||
890 | * |
||
891 | * @param string $value Sheet state (visible, hidden, veryHidden) |
||
892 | * @return Worksheet |
||
893 | */ |
||
894 | public function setSheetState($value = Worksheet::SHEETSTATE_VISIBLE) |
||
899 | |||
900 | /** |
||
901 | * Get page setup |
||
902 | * |
||
903 | * @return Worksheet\PageSetup |
||
904 | */ |
||
905 | public function getPageSetup() |
||
909 | |||
910 | /** |
||
911 | * Set page setup |
||
912 | * |
||
913 | * @param Worksheet\PageSetup $pValue |
||
914 | * @return Worksheet |
||
915 | */ |
||
916 | public function setPageSetup(Worksheet\PageSetup $pValue) |
||
921 | |||
922 | /** |
||
923 | * Get page margins |
||
924 | * |
||
925 | * @return Worksheet\PageMargins |
||
926 | */ |
||
927 | public function getPageMargins() |
||
931 | |||
932 | /** |
||
933 | * Set page margins |
||
934 | * |
||
935 | * @param Worksheet\PageMargins $pValue |
||
936 | * @return Worksheet |
||
937 | */ |
||
938 | public function setPageMargins(Worksheet\PageMargins $pValue) |
||
943 | |||
944 | /** |
||
945 | * Get page header/footer |
||
946 | * |
||
947 | * @return Worksheet\HeaderFooter |
||
948 | */ |
||
949 | public function getHeaderFooter() |
||
953 | |||
954 | /** |
||
955 | * Set page header/footer |
||
956 | * |
||
957 | * @param Worksheet\HeaderFooter $pValue |
||
958 | * @return Worksheet |
||
959 | */ |
||
960 | public function setHeaderFooter(Worksheet\HeaderFooter $pValue) |
||
965 | |||
966 | /** |
||
967 | * Get sheet view |
||
968 | * |
||
969 | * @return Worksheet\SheetView |
||
970 | */ |
||
971 | public function getSheetView() |
||
975 | |||
976 | /** |
||
977 | * Set sheet view |
||
978 | * |
||
979 | * @param Worksheet\SheetView $pValue |
||
980 | * @return Worksheet |
||
981 | */ |
||
982 | public function setSheetView(Worksheet\SheetView $pValue) |
||
987 | |||
988 | /** |
||
989 | * Get Protection |
||
990 | * |
||
991 | * @return Worksheet\Protection |
||
992 | */ |
||
993 | public function getProtection() |
||
997 | |||
998 | /** |
||
999 | * Set Protection |
||
1000 | * |
||
1001 | * @param Worksheet\Protection $pValue |
||
1002 | * @return Worksheet |
||
1003 | */ |
||
1004 | public function setProtection(Worksheet\Protection $pValue) |
||
1011 | |||
1012 | /** |
||
1013 | * Get highest worksheet column |
||
1014 | * |
||
1015 | * @param string $row Return the data highest column for the specified row, |
||
1016 | * or the highest column of any row if no row number is passed |
||
1017 | * @return string Highest column name |
||
1018 | */ |
||
1019 | public function getHighestColumn($row = null) |
||
1026 | |||
1027 | /** |
||
1028 | * Get highest worksheet column that contains data |
||
1029 | * |
||
1030 | * @param string $row Return the highest data column for the specified row, |
||
1031 | * or the highest data column of any row if no row number is passed |
||
1032 | * @return string Highest column name that contains data |
||
1033 | */ |
||
1034 | public function getHighestDataColumn($row = null) |
||
1038 | |||
1039 | /** |
||
1040 | * Get highest worksheet row |
||
1041 | * |
||
1042 | * @param string $column Return the highest data row for the specified column, |
||
1043 | * or the highest row of any column if no column letter is passed |
||
1044 | * @return int Highest row number |
||
1045 | */ |
||
1046 | public function getHighestRow($column = null) |
||
1053 | |||
1054 | /** |
||
1055 | * Get highest worksheet row that contains data |
||
1056 | * |
||
1057 | * @param string $column Return the highest data row for the specified column, |
||
1058 | * or the highest data row of any column if no column letter is passed |
||
1059 | * @return string Highest row number that contains data |
||
1060 | */ |
||
1061 | public function getHighestDataRow($column = null) |
||
1065 | |||
1066 | /** |
||
1067 | * Get highest worksheet column and highest row that have cell records |
||
1068 | * |
||
1069 | * @return array Highest column name and highest row number |
||
1070 | */ |
||
1071 | public function getHighestRowAndColumn() |
||
1075 | |||
1076 | /** |
||
1077 | * Set a cell value |
||
1078 | * |
||
1079 | * @param string $pCoordinate Coordinate of the cell |
||
1080 | * @param mixed $pValue Value of the cell |
||
1081 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1082 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1083 | */ |
||
1084 | public function setCellValue($pCoordinate = 'A1', $pValue = null, $returnCell = false) |
||
1089 | |||
1090 | /** |
||
1091 | * Set a cell value by using numeric cell coordinates |
||
1092 | * |
||
1093 | * @param string $pColumn Numeric column coordinate of the cell (A = 0) |
||
1094 | * @param string $pRow Numeric row coordinate of the cell |
||
1095 | * @param mixed $pValue Value of the cell |
||
1096 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1097 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1098 | */ |
||
1099 | public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $returnCell = false) |
||
1104 | |||
1105 | /** |
||
1106 | * Set a cell value |
||
1107 | * |
||
1108 | * @param string $pCoordinate Coordinate of the cell |
||
1109 | * @param mixed $pValue Value of the cell |
||
1110 | * @param string $pDataType Explicit data type |
||
1111 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1112 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1113 | */ |
||
1114 | public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = Cell\DataType::TYPE_STRING, $returnCell = false) |
||
1120 | |||
1121 | /** |
||
1122 | * Set a cell value by using numeric cell coordinates |
||
1123 | * |
||
1124 | * @param string $pColumn Numeric column coordinate of the cell |
||
1125 | * @param string $pRow Numeric row coordinate of the cell |
||
1126 | * @param mixed $pValue Value of the cell |
||
1127 | * @param string $pDataType Explicit data type |
||
1128 | * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
||
1129 | * @return Worksheet|Cell Depending on the last parameter being specified |
||
1130 | */ |
||
1131 | public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = Cell\DataType::TYPE_STRING, $returnCell = false) |
||
1136 | |||
1137 | /** |
||
1138 | * Get cell at a specific coordinate |
||
1139 | * |
||
1140 | * @param string $pCoordinate Coordinate of the cell |
||
1141 | * @param boolean $createIfNotExists Flag indicating whether a new cell should be created if it doesn't |
||
1142 | * already exist, or a null should be returned instead |
||
1143 | * @throws Exception |
||
1144 | * @return null|Cell Cell that was found/created or null |
||
1145 | */ |
||
1146 | public function getCell($pCoordinate = 'A1', $createIfNotExists = true) |
||
1181 | |||
1182 | /** |
||
1183 | * Get cell at a specific coordinate by using numeric cell coordinates |
||
1184 | * |
||
1185 | * @param string $pColumn Numeric column coordinate of the cell |
||
1186 | * @param string $pRow Numeric row coordinate of the cell |
||
1187 | * @param boolean $createIfNotExists Flag indicating whether a new cell should be created if it doesn't |
||
1188 | * already exist, or a null should be returned instead |
||
1189 | * @return null|Cell Cell that was found/created or null |
||
1190 | */ |
||
1191 | public function getCellByColumnAndRow($pColumn = 0, $pRow = 1, $createIfNotExists = true) |
||
1203 | |||
1204 | /** |
||
1205 | * Create a new cell at the specified coordinate |
||
1206 | * |
||
1207 | * @param string $pCoordinate Coordinate of the cell |
||
1208 | * @return Cell Cell that was created |
||
1209 | */ |
||
1210 | private function createNewCell($pCoordinate) |
||
1240 | |||
1241 | /** |
||
1242 | * Does the cell at a specific coordinate exist? |
||
1243 | * |
||
1244 | * @param string $pCoordinate Coordinate of the cell |
||
1245 | * @throws Exception |
||
1246 | * @return boolean |
||
1247 | */ |
||
1248 | public function cellExists($pCoordinate = 'A1') |
||
1289 | |||
1290 | /** |
||
1291 | * Cell at a specific coordinate by using numeric cell coordinates exists? |
||
1292 | * |
||
1293 | * @param string $pColumn Numeric column coordinate of the cell |
||
1294 | * @param string $pRow Numeric row coordinate of the cell |
||
1295 | * @return boolean |
||
1296 | */ |
||
1297 | public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 1) |
||
1301 | |||
1302 | /** |
||
1303 | * Get row dimension at a specific row |
||
1304 | * |
||
1305 | * @param int $pRow Numeric index of the row |
||
1306 | * @return Worksheet\RowDimension |
||
1307 | */ |
||
1308 | public function getRowDimension($pRow = 1, $create = true) |
||
1324 | |||
1325 | /** |
||
1326 | * Get column dimension at a specific column |
||
1327 | * |
||
1328 | * @param string $pColumn String index of the column |
||
1329 | * @return Worksheet\ColumnDimension |
||
1330 | */ |
||
1331 | public function getColumnDimension($pColumn = 'A', $create = true) |
||
1349 | |||
1350 | /** |
||
1351 | * Get column dimension at a specific column by using numeric cell coordinates |
||
1352 | * |
||
1353 | * @param string $pColumn Numeric column coordinate of the cell |
||
1354 | * @return Worksheet\ColumnDimension |
||
1355 | */ |
||
1356 | public function getColumnDimensionByColumn($pColumn = 0) |
||
1360 | |||
1361 | /** |
||
1362 | * Get styles |
||
1363 | * |
||
1364 | * @return Style[] |
||
1365 | */ |
||
1366 | public function getStyles() |
||
1370 | |||
1371 | /** |
||
1372 | * Get default style of workbook. |
||
1373 | * |
||
1374 | * @deprecated |
||
1375 | * @return Style |
||
1376 | * @throws Exception |
||
1377 | */ |
||
1378 | public function getDefaultStyle() |
||
1382 | |||
1383 | /** |
||
1384 | * Set default style - should only be used by \PhpSpreadsheet\IReader implementations! |
||
1385 | * |
||
1386 | * @deprecated |
||
1387 | * @param Style $pValue |
||
1388 | * @throws Exception |
||
1389 | * @return Worksheet |
||
1390 | */ |
||
1391 | public function setDefaultStyle(Style $pValue) |
||
1401 | |||
1402 | /** |
||
1403 | * Get style for cell |
||
1404 | * |
||
1405 | * @param string $pCellCoordinate Cell coordinate (or range) to get style for |
||
1406 | * @return Style |
||
1407 | * @throws Exception |
||
1408 | */ |
||
1409 | public function getStyle($pCellCoordinate = 'A1') |
||
1419 | |||
1420 | /** |
||
1421 | * Get conditional styles for a cell |
||
1422 | * |
||
1423 | * @param string $pCoordinate |
||
1424 | * @return Style\Conditional[] |
||
1425 | */ |
||
1426 | public function getConditionalStyles($pCoordinate = 'A1') |
||
1434 | |||
1435 | /** |
||
1436 | * Do conditional styles exist for this cell? |
||
1437 | * |
||
1438 | * @param string $pCoordinate |
||
1439 | * @return boolean |
||
1440 | */ |
||
1441 | public function conditionalStylesExists($pCoordinate = 'A1') |
||
1448 | |||
1449 | /** |
||
1450 | * Removes conditional styles for a cell |
||
1451 | * |
||
1452 | * @param string $pCoordinate |
||
1453 | * @return Worksheet |
||
1454 | */ |
||
1455 | public function removeConditionalStyles($pCoordinate = 'A1') |
||
1460 | |||
1461 | /** |
||
1462 | * Get collection of conditional styles |
||
1463 | * |
||
1464 | * @return array |
||
1465 | */ |
||
1466 | public function getConditionalStylesCollection() |
||
1470 | |||
1471 | /** |
||
1472 | * Set conditional styles |
||
1473 | * |
||
1474 | * @param $pCoordinate string E.g. 'A1' |
||
1475 | * @param $pValue Style\Conditional[] |
||
1476 | * @return Worksheet |
||
1477 | */ |
||
1478 | public function setConditionalStyles($pCoordinate, $pValue) |
||
1483 | |||
1484 | /** |
||
1485 | * Get style for cell by using numeric cell coordinates |
||
1486 | * |
||
1487 | * @param int $pColumn Numeric column coordinate of the cell |
||
1488 | * @param int $pRow Numeric row coordinate of the cell |
||
1489 | * @param int pColumn2 Numeric column coordinate of the range cell |
||
1490 | * @param int pRow2 Numeric row coordinate of the range cell |
||
1491 | * @return Style |
||
1492 | */ |
||
1493 | public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1, $pColumn2 = null, $pRow2 = null) |
||
1502 | |||
1503 | /** |
||
1504 | * Set shared cell style to a range of cells |
||
1505 | * |
||
1506 | * Please note that this will overwrite existing cell styles for cells in range! |
||
1507 | * |
||
1508 | * @deprecated duplicateStyle |
||
1509 | * @param Style $pSharedCellStyle Cell style to share |
||
1510 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
1511 | * @throws Exception |
||
1512 | * @return Worksheet |
||
1513 | */ |
||
1514 | public function setSharedStyle(Style $pSharedCellStyle = null, $pRange = '') |
||
1519 | |||
1520 | /** |
||
1521 | * Duplicate cell style to a range of cells |
||
1522 | * |
||
1523 | * Please note that this will overwrite existing cell styles for cells in range! |
||
1524 | * |
||
1525 | * @param Style $pCellStyle Cell style to duplicate |
||
1526 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
1527 | * @throws Exception |
||
1528 | * @return Worksheet |
||
1529 | */ |
||
1530 | public function duplicateStyle(Style $pCellStyle = null, $pRange = '') |
||
1565 | |||
1566 | /** |
||
1567 | * Duplicate conditional style to a range of cells |
||
1568 | * |
||
1569 | * Please note that this will overwrite existing cell styles for cells in range! |
||
1570 | * |
||
1571 | * @param Style\Conditional[] $pCellStyle Cell style to duplicate |
||
1572 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
1573 | * @throws Exception |
||
1574 | * @return Worksheet |
||
1575 | */ |
||
1576 | public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '') |
||
1603 | |||
1604 | /** |
||
1605 | * Duplicate cell style array to a range of cells |
||
1606 | * |
||
1607 | * Please note that this will overwrite existing cell styles for cells in range, |
||
1608 | * if they are in the styles array. For example, if you decide to set a range of |
||
1609 | * cells to font bold, only include font bold in the styles array. |
||
1610 | * |
||
1611 | * @deprecated |
||
1612 | * @param array $pStyles Array containing style information |
||
1613 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
1614 | * @param boolean $pAdvanced Advanced mode for setting borders. |
||
1615 | * @throws Exception |
||
1616 | * @return Worksheet |
||
1617 | */ |
||
1618 | public function duplicateStyleArray($pStyles = null, $pRange = '', $pAdvanced = true) |
||
1623 | |||
1624 | /** |
||
1625 | * Set break on a cell |
||
1626 | * |
||
1627 | * @param string $pCell Cell coordinate (e.g. A1) |
||
1628 | * @param int $pBreak Break type (type of Worksheet::BREAK_*) |
||
1629 | * @throws Exception |
||
1630 | * @return Worksheet |
||
1631 | */ |
||
1632 | public function setBreak($pCell = 'A1', $pBreak = Worksheet::BREAK_NONE) |
||
1651 | |||
1652 | /** |
||
1653 | * Set break on a cell by using numeric cell coordinates |
||
1654 | * |
||
1655 | * @param integer $pColumn Numeric column coordinate of the cell |
||
1656 | * @param integer $pRow Numeric row coordinate of the cell |
||
1657 | * @param integer $pBreak Break type (type of \PhpSpreadsheet\Worksheet::BREAK_*) |
||
1658 | * @return Worksheet |
||
1659 | */ |
||
1660 | public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = Worksheet::BREAK_NONE) |
||
1664 | |||
1665 | /** |
||
1666 | * Get breaks |
||
1667 | * |
||
1668 | * @return array[] |
||
1669 | */ |
||
1670 | public function getBreaks() |
||
1674 | |||
1675 | /** |
||
1676 | * Set merge on a cell range |
||
1677 | * |
||
1678 | * @param string $pRange Cell range (e.g. A1:E1) |
||
1679 | * @throws Exception |
||
1680 | * @return Worksheet |
||
1681 | */ |
||
1682 | public function mergeCells($pRange = 'A1:A1') |
||
1714 | |||
1715 | /** |
||
1716 | * Set merge on a cell range by using numeric cell coordinates |
||
1717 | * |
||
1718 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1719 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1720 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1721 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1722 | * @throws Exception |
||
1723 | * @return Worksheet |
||
1724 | */ |
||
1725 | public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) |
||
1730 | |||
1731 | /** |
||
1732 | * Remove merge on a cell range |
||
1733 | * |
||
1734 | * @param string $pRange Cell range (e.g. A1:E1) |
||
1735 | * @throws Exception |
||
1736 | * @return Worksheet |
||
1737 | */ |
||
1738 | public function unmergeCells($pRange = 'A1:A1') |
||
1755 | |||
1756 | /** |
||
1757 | * Remove merge on a cell range by using numeric cell coordinates |
||
1758 | * |
||
1759 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1760 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1761 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1762 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1763 | * @throws Exception |
||
1764 | * @return Worksheet |
||
1765 | */ |
||
1766 | public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) |
||
1771 | |||
1772 | /** |
||
1773 | * Get merge cells array. |
||
1774 | * |
||
1775 | * @return array[] |
||
1776 | */ |
||
1777 | public function getMergeCells() |
||
1781 | |||
1782 | /** |
||
1783 | * Set merge cells array for the entire sheet. Use instead mergeCells() to merge |
||
1784 | * a single cell range. |
||
1785 | * |
||
1786 | * @param array |
||
1787 | */ |
||
1788 | public function setMergeCells($pValue = array()) |
||
1793 | |||
1794 | /** |
||
1795 | * Set protection on a cell range |
||
1796 | * |
||
1797 | * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) |
||
1798 | * @param string $pPassword Password to unlock the protection |
||
1799 | * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true |
||
1800 | * @throws Exception |
||
1801 | * @return Worksheet |
||
1802 | */ |
||
1803 | public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false) |
||
1815 | |||
1816 | /** |
||
1817 | * Set protection on a cell range by using numeric cell coordinates |
||
1818 | * |
||
1819 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1820 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1821 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1822 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1823 | * @param string $pPassword Password to unlock the protection |
||
1824 | * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true |
||
1825 | * @throws Exception |
||
1826 | * @return Worksheet |
||
1827 | */ |
||
1828 | public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) |
||
1833 | |||
1834 | /** |
||
1835 | * Remove protection on a cell range |
||
1836 | * |
||
1837 | * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) |
||
1838 | * @throws Exception |
||
1839 | * @return Worksheet |
||
1840 | */ |
||
1841 | public function unprotectCells($pRange = 'A1') |
||
1853 | |||
1854 | /** |
||
1855 | * Remove protection on a cell range by using numeric cell coordinates |
||
1856 | * |
||
1857 | * @param int $pColumn1 Numeric column coordinate of the first cell |
||
1858 | * @param int $pRow1 Numeric row coordinate of the first cell |
||
1859 | * @param int $pColumn2 Numeric column coordinate of the last cell |
||
1860 | * @param int $pRow2 Numeric row coordinate of the last cell |
||
1861 | * @param string $pPassword Password to unlock the protection |
||
1862 | * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true |
||
1863 | * @throws Exception |
||
1864 | * @return Worksheet |
||
1865 | */ |
||
1866 | public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) |
||
1871 | |||
1872 | /** |
||
1873 | * Get protected cells |
||
1874 | * |
||
1875 | * @return array[] |
||
1876 | */ |
||
1877 | public function getProtectedCells() |
||
1881 | |||
1882 | /** |
||
1883 | * Get Autofilter |
||
1884 | * |
||
1885 | * @return Worksheet\AutoFilter |
||
1886 | */ |
||
1887 | public function getAutoFilter() |
||
1891 | |||
1892 | /** |
||
1893 | * Set AutoFilter |
||
1894 | * |
||
1895 | * @param Worksheet\AutoFilter|string $pValue |
||
1896 | * A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility |
||
1897 | * @throws Exception |
||
1898 | * @return Worksheet |
||
1899 | */ |
||
1900 | public function setAutoFilter($pValue) |
||
1910 | |||
1911 | /** |
||
1912 | * Set Autofilter Range by using numeric cell coordinates |
||
1913 | * |
||
1914 | * @param integer $pColumn1 Numeric column coordinate of the first cell |
||
1915 | * @param integer $pRow1 Numeric row coordinate of the first cell |
||
1916 | * @param integer $pColumn2 Numeric column coordinate of the second cell |
||
1917 | * @param integer $pRow2 Numeric row coordinate of the second cell |
||
1918 | * @throws Exception |
||
1919 | * @return Worksheet |
||
1920 | */ |
||
1921 | public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) |
||
1929 | |||
1930 | /** |
||
1931 | * Remove autofilter |
||
1932 | * |
||
1933 | * @return Worksheet |
||
1934 | */ |
||
1935 | public function removeAutoFilter() |
||
1940 | |||
1941 | /** |
||
1942 | * Get Freeze Pane |
||
1943 | * |
||
1944 | * @return string |
||
1945 | */ |
||
1946 | public function getFreezePane() |
||
1950 | |||
1951 | /** |
||
1952 | * Freeze Pane |
||
1953 | * |
||
1954 | * @param string $pCell Cell (i.e. A2) |
||
1955 | * Examples: |
||
1956 | * A2 will freeze the rows above cell A2 (i.e row 1) |
||
1957 | * B1 will freeze the columns to the left of cell B1 (i.e column A) |
||
1958 | * B2 will freeze the rows above and to the left of cell A2 |
||
1959 | * (i.e row 1 and column A) |
||
1960 | * @throws Exception |
||
1961 | * @return Worksheet |
||
1962 | */ |
||
1963 | public function freezePane($pCell = '') |
||
1974 | |||
1975 | /** |
||
1976 | * Freeze Pane by using numeric cell coordinates |
||
1977 | * |
||
1978 | * @param int $pColumn Numeric column coordinate of the cell |
||
1979 | * @param int $pRow Numeric row coordinate of the cell |
||
1980 | * @throws Exception |
||
1981 | * @return Worksheet |
||
1982 | */ |
||
1983 | public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 1) |
||
1987 | |||
1988 | /** |
||
1989 | * Unfreeze Pane |
||
1990 | * |
||
1991 | * @return Worksheet |
||
1992 | */ |
||
1993 | public function unfreezePane() |
||
1997 | |||
1998 | /** |
||
1999 | * Insert a new row, updating all possible related data |
||
2000 | * |
||
2001 | * @param int $pBefore Insert before this one |
||
2002 | * @param int $pNumRows Number of rows to insert |
||
2003 | * @throws Exception |
||
2004 | * @return Worksheet |
||
2005 | */ |
||
2006 | View Code Duplication | public function insertNewRowBefore($pBefore = 1, $pNumRows = 1) |
|
2016 | |||
2017 | /** |
||
2018 | * Insert a new column, updating all possible related data |
||
2019 | * |
||
2020 | * @param int $pBefore Insert before this one |
||
2021 | * @param int $pNumCols Number of columns to insert |
||
2022 | * @throws Exception |
||
2023 | * @return Worksheet |
||
2024 | */ |
||
2025 | View Code Duplication | public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1) |
|
2035 | |||
2036 | /** |
||
2037 | * Insert a new column, updating all possible related data |
||
2038 | * |
||
2039 | * @param int $pBefore Insert before this one (numeric column coordinate of the cell) |
||
2040 | * @param int $pNumCols Number of columns to insert |
||
2041 | * @throws Exception |
||
2042 | * @return Worksheet |
||
2043 | */ |
||
2044 | public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1) |
||
2052 | |||
2053 | /** |
||
2054 | * Delete a row, updating all possible related data |
||
2055 | * |
||
2056 | * @param int $pRow Remove starting with this one |
||
2057 | * @param int $pNumRows Number of rows to remove |
||
2058 | * @throws Exception |
||
2059 | * @return Worksheet |
||
2060 | */ |
||
2061 | public function removeRow($pRow = 1, $pNumRows = 1) |
||
2076 | |||
2077 | /** |
||
2078 | * Remove a column, updating all possible related data |
||
2079 | * |
||
2080 | * @param string $pColumn Remove starting with this one |
||
2081 | * @param int $pNumCols Number of columns to remove |
||
2082 | * @throws Exception |
||
2083 | * @return Worksheet |
||
2084 | */ |
||
2085 | public function removeColumn($pColumn = 'A', $pNumCols = 1) |
||
2101 | |||
2102 | /** |
||
2103 | * Remove a column, updating all possible related data |
||
2104 | * |
||
2105 | * @param int $pColumn Remove starting with this one (numeric column coordinate of the cell) |
||
2106 | * @param int $pNumCols Number of columns to remove |
||
2107 | * @throws Exception |
||
2108 | * @return Worksheet |
||
2109 | */ |
||
2110 | public function removeColumnByIndex($pColumn = 0, $pNumCols = 1) |
||
2118 | |||
2119 | /** |
||
2120 | * Show gridlines? |
||
2121 | * |
||
2122 | * @return boolean |
||
2123 | */ |
||
2124 | public function getShowGridlines() |
||
2128 | |||
2129 | /** |
||
2130 | * Set show gridlines |
||
2131 | * |
||
2132 | * @param boolean $pValue Show gridlines (true/false) |
||
2133 | * @return Worksheet |
||
2134 | */ |
||
2135 | public function setShowGridlines($pValue = false) |
||
2140 | |||
2141 | /** |
||
2142 | * Print gridlines? |
||
2143 | * |
||
2144 | * @return boolean |
||
2145 | */ |
||
2146 | public function getPrintGridlines() |
||
2150 | |||
2151 | /** |
||
2152 | * Set print gridlines |
||
2153 | * |
||
2154 | * @param boolean $pValue Print gridlines (true/false) |
||
2155 | * @return Worksheet |
||
2156 | */ |
||
2157 | public function setPrintGridlines($pValue = false) |
||
2162 | |||
2163 | /** |
||
2164 | * Show row and column headers? |
||
2165 | * |
||
2166 | * @return boolean |
||
2167 | */ |
||
2168 | public function getShowRowColHeaders() |
||
2172 | |||
2173 | /** |
||
2174 | * Set show row and column headers |
||
2175 | * |
||
2176 | * @param boolean $pValue Show row and column headers (true/false) |
||
2177 | * @return Worksheet |
||
2178 | */ |
||
2179 | public function setShowRowColHeaders($pValue = false) |
||
2184 | |||
2185 | /** |
||
2186 | * Show summary below? (Row/Column outlining) |
||
2187 | * |
||
2188 | * @return boolean |
||
2189 | */ |
||
2190 | public function getShowSummaryBelow() |
||
2194 | |||
2195 | /** |
||
2196 | * Set show summary below |
||
2197 | * |
||
2198 | * @param boolean $pValue Show summary below (true/false) |
||
2199 | * @return Worksheet |
||
2200 | */ |
||
2201 | public function setShowSummaryBelow($pValue = true) |
||
2206 | |||
2207 | /** |
||
2208 | * Show summary right? (Row/Column outlining) |
||
2209 | * |
||
2210 | * @return boolean |
||
2211 | */ |
||
2212 | public function getShowSummaryRight() |
||
2216 | |||
2217 | /** |
||
2218 | * Set show summary right |
||
2219 | * |
||
2220 | * @param boolean $pValue Show summary right (true/false) |
||
2221 | * @return Worksheet |
||
2222 | */ |
||
2223 | public function setShowSummaryRight($pValue = true) |
||
2228 | |||
2229 | /** |
||
2230 | * Get comments |
||
2231 | * |
||
2232 | * @return Comment[] |
||
2233 | */ |
||
2234 | public function getComments() |
||
2238 | |||
2239 | /** |
||
2240 | * Set comments array for the entire sheet. |
||
2241 | * |
||
2242 | * @param array of Comment |
||
2243 | * @return Worksheet |
||
2244 | */ |
||
2245 | public function setComments($pValue = array()) |
||
2251 | |||
2252 | /** |
||
2253 | * Get comment for cell |
||
2254 | * |
||
2255 | * @param string $pCellCoordinate Cell coordinate to get comment for |
||
2256 | * @return Comment |
||
2257 | * @throws Exception |
||
2258 | */ |
||
2259 | public function getComment($pCellCoordinate = 'A1') |
||
2282 | |||
2283 | /** |
||
2284 | * Get comment for cell by using numeric cell coordinates |
||
2285 | * |
||
2286 | * @param int $pColumn Numeric column coordinate of the cell |
||
2287 | * @param int $pRow Numeric row coordinate of the cell |
||
2288 | * @return Comment |
||
2289 | */ |
||
2290 | public function getCommentByColumnAndRow($pColumn = 0, $pRow = 1) |
||
2294 | |||
2295 | /** |
||
2296 | * Get selected cell |
||
2297 | * |
||
2298 | * @deprecated |
||
2299 | * @return string |
||
2300 | */ |
||
2301 | public function getSelectedCell() |
||
2305 | |||
2306 | /** |
||
2307 | * Get active cell |
||
2308 | * |
||
2309 | * @return string Example: 'A1' |
||
2310 | */ |
||
2311 | public function getActiveCell() |
||
2315 | |||
2316 | /** |
||
2317 | * Get selected cells |
||
2318 | * |
||
2319 | * @return string |
||
2320 | */ |
||
2321 | public function getSelectedCells() |
||
2325 | |||
2326 | /** |
||
2327 | * Selected cell |
||
2328 | * |
||
2329 | * @param string $pCoordinate Cell (i.e. A1) |
||
2330 | * @return Worksheet |
||
2331 | */ |
||
2332 | public function setSelectedCell($pCoordinate = 'A1') |
||
2336 | |||
2337 | /** |
||
2338 | * Select a range of cells. |
||
2339 | * |
||
2340 | * @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6' |
||
2341 | * @throws Exception |
||
2342 | * @return Worksheet |
||
2343 | */ |
||
2344 | public function setSelectedCells($pCoordinate = 'A1') |
||
2370 | |||
2371 | /** |
||
2372 | * Selected cell by using numeric cell coordinates |
||
2373 | * |
||
2374 | * @param int $pColumn Numeric column coordinate of the cell |
||
2375 | * @param int $pRow Numeric row coordinate of the cell |
||
2376 | * @throws Exception |
||
2377 | * @return Worksheet |
||
2378 | */ |
||
2379 | public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 1) |
||
2383 | |||
2384 | /** |
||
2385 | * Get right-to-left |
||
2386 | * |
||
2387 | * @return boolean |
||
2388 | */ |
||
2389 | public function getRightToLeft() |
||
2393 | |||
2394 | /** |
||
2395 | * Set right-to-left |
||
2396 | * |
||
2397 | * @param boolean $value Right-to-left true/false |
||
2398 | * @return Worksheet |
||
2399 | */ |
||
2400 | public function setRightToLeft($value = false) |
||
2405 | |||
2406 | /** |
||
2407 | * Fill worksheet from values in array |
||
2408 | * |
||
2409 | * @param array $source Source array |
||
2410 | * @param mixed $nullValue Value in source array that stands for blank cell |
||
2411 | * @param string $startCell Insert array starting from this cell address as the top left coordinate |
||
2412 | * @param boolean $strictNullComparison Apply strict comparison when testing for null values in the array |
||
2413 | * @throws Exception |
||
2414 | * @return Worksheet |
||
2415 | */ |
||
2416 | public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) |
||
2451 | |||
2452 | /** |
||
2453 | * Create array from a range of cells |
||
2454 | * |
||
2455 | * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") |
||
2456 | * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist |
||
2457 | * @param boolean $calculateFormulas Should formulas be calculated? |
||
2458 | * @param boolean $formatData Should formatting be applied to cell values? |
||
2459 | * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero |
||
2460 | * True - Return rows and columns indexed by their actual row and column IDs |
||
2461 | * @return array |
||
2462 | */ |
||
2463 | public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) |
||
2520 | |||
2521 | |||
2522 | /** |
||
2523 | * Create array from a range of cells |
||
2524 | * |
||
2525 | * @param string $pNamedRange Name of the Named Range |
||
2526 | * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist |
||
2527 | * @param boolean $calculateFormulas Should formulas be calculated? |
||
2528 | * @param boolean $formatData Should formatting be applied to cell values? |
||
2529 | * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero |
||
2530 | * True - Return rows and columns indexed by their actual row and column IDs |
||
2531 | * @return array |
||
2532 | * @throws Exception |
||
2533 | */ |
||
2534 | public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) |
||
2546 | |||
2547 | |||
2548 | /** |
||
2549 | * Create array from worksheet |
||
2550 | * |
||
2551 | * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist |
||
2552 | * @param boolean $calculateFormulas Should formulas be calculated? |
||
2553 | * @param boolean $formatData Should formatting be applied to cell values? |
||
2554 | * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero |
||
2555 | * True - Return rows and columns indexed by their actual row and column IDs |
||
2556 | * @return array |
||
2557 | */ |
||
2558 | public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) |
||
2569 | |||
2570 | /** |
||
2571 | * Get row iterator |
||
2572 | * |
||
2573 | * @param integer $startRow The row number at which to start iterating |
||
2574 | * @param integer $endRow The row number at which to stop iterating |
||
2575 | * |
||
2576 | * @return Worksheet\RowIterator |
||
2577 | */ |
||
2578 | public function getRowIterator($startRow = 1, $endRow = null) |
||
2582 | |||
2583 | /** |
||
2584 | * Get column iterator |
||
2585 | * |
||
2586 | * @param string $startColumn The column address at which to start iterating |
||
2587 | * @param string $endColumn The column address at which to stop iterating |
||
2588 | * |
||
2589 | * @return Worksheet\ColumnIterator |
||
2590 | */ |
||
2591 | public function getColumnIterator($startColumn = 'A', $endColumn = null) |
||
2595 | |||
2596 | /** |
||
2597 | * Run PhpSpreadsheet garabage collector. |
||
2598 | * |
||
2599 | * @return Worksheet |
||
2600 | */ |
||
2601 | public function garbageCollect() |
||
2640 | |||
2641 | /** |
||
2642 | * Get hash code |
||
2643 | * |
||
2644 | * @return string Hash code |
||
2645 | */ |
||
2646 | public function getHashCode() |
||
2654 | |||
2655 | /** |
||
2656 | * Extract worksheet title from range. |
||
2657 | * |
||
2658 | * Example: extractSheetTitle("testSheet!A1") ==> 'A1' |
||
2659 | * Example: extractSheetTitle("'testSheet 1'!A1", true) ==> array('testSheet 1', 'A1'); |
||
2660 | * |
||
2661 | * @param string $pRange Range to extract title from |
||
2662 | * @param bool $returnRange Return range? (see example) |
||
2663 | * @return mixed |
||
2664 | */ |
||
2665 | public static function extractSheetTitle($pRange, $returnRange = false) |
||
2678 | |||
2679 | /** |
||
2680 | * Get hyperlink |
||
2681 | * |
||
2682 | * @param string $pCellCoordinate Cell coordinate to get hyperlink for |
||
2683 | */ |
||
2684 | View Code Duplication | public function getHyperlink($pCellCoordinate = 'A1') |
|
2695 | |||
2696 | /** |
||
2697 | * Set hyperlnk |
||
2698 | * |
||
2699 | * @param string $pCellCoordinate Cell coordinate to insert hyperlink |
||
2700 | * @param Cell\Hyperlink $pHyperlink |
||
2701 | * @return Worksheet |
||
2702 | */ |
||
2703 | public function setHyperlink($pCellCoordinate = 'A1', Cell\Hyperlink $pHyperlink = null) |
||
2712 | |||
2713 | /** |
||
2714 | * Hyperlink at a specific coordinate exists? |
||
2715 | * |
||
2716 | * @param string $pCoordinate |
||
2717 | * @return boolean |
||
2718 | */ |
||
2719 | public function hyperlinkExists($pCoordinate = 'A1') |
||
2723 | |||
2724 | /** |
||
2725 | * Get collection of hyperlinks |
||
2726 | * |
||
2727 | * @return Cell\Hyperlink[] |
||
2728 | */ |
||
2729 | public function getHyperlinkCollection() |
||
2733 | |||
2734 | /** |
||
2735 | * Get data validation |
||
2736 | * |
||
2737 | * @param string $pCellCoordinate Cell coordinate to get data validation for |
||
2738 | */ |
||
2739 | View Code Duplication | public function getDataValidation($pCellCoordinate = 'A1') |
|
2750 | |||
2751 | /** |
||
2752 | * Set data validation |
||
2753 | * |
||
2754 | * @param string $pCellCoordinate Cell coordinate to insert data validation |
||
2755 | * @param Cell\DataValidation $pDataValidation |
||
2756 | * @return Worksheet |
||
2757 | */ |
||
2758 | public function setDataValidation($pCellCoordinate = 'A1', Cell\DataValidation $pDataValidation = null) |
||
2767 | |||
2768 | /** |
||
2769 | * Data validation at a specific coordinate exists? |
||
2770 | * |
||
2771 | * @param string $pCoordinate |
||
2772 | * @return boolean |
||
2773 | */ |
||
2774 | public function dataValidationExists($pCoordinate = 'A1') |
||
2778 | |||
2779 | /** |
||
2780 | * Get collection of data validations |
||
2781 | * |
||
2782 | * @return Cell\DataValidation[] |
||
2783 | */ |
||
2784 | public function getDataValidationCollection() |
||
2788 | |||
2789 | /** |
||
2790 | * Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet |
||
2791 | * |
||
2792 | * @param string $range |
||
2793 | * @return string Adjusted range value |
||
2794 | */ |
||
2795 | public function shrinkRangeToFit($range) |
||
2824 | |||
2825 | /** |
||
2826 | * Get tab color |
||
2827 | * |
||
2828 | * @return Style\Color |
||
2829 | */ |
||
2830 | public function getTabColor() |
||
2837 | |||
2838 | /** |
||
2839 | * Reset tab color |
||
2840 | * |
||
2841 | * @return Worksheet |
||
2842 | */ |
||
2843 | public function resetTabColor() |
||
2850 | |||
2851 | /** |
||
2852 | * Tab color set? |
||
2853 | * |
||
2854 | * @return boolean |
||
2855 | */ |
||
2856 | public function isTabColorSet() |
||
2860 | |||
2861 | /** |
||
2862 | * Copy worksheet (!= clone!) |
||
2863 | * |
||
2864 | * @return Worksheet |
||
2865 | */ |
||
2866 | public function copy() |
||
2872 | |||
2873 | /** |
||
2874 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
||
2875 | */ |
||
2876 | public function __clone() |
||
2901 | /** |
||
2902 | * Define the code name of the sheet |
||
2903 | * |
||
2904 | * @param null|string Same rule as Title minus space not allowed (but, like Excel, change silently space to underscore) |
||
2905 | * @return objWorksheet |
||
2906 | * @throws Exception |
||
2907 | */ |
||
2908 | public function setCodeName($pValue = null) |
||
2952 | /** |
||
2953 | * Return the code name of the sheet |
||
2954 | * |
||
2955 | * @return null|string |
||
2956 | */ |
||
2957 | public function getCodeName() |
||
2961 | /** |
||
2962 | * Sheet has a code name ? |
||
2963 | * @return boolean |
||
2964 | */ |
||
2965 | public function hasCodeName() |
||
2969 | } |
||
2970 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.