|
32 | 32 | class Worksheet implements IComparable
|
33 | 33 | {
|
34 | 34 | // Break types
|
35 |
| - const BREAK_NONE = 0; |
36 |
| - const BREAK_ROW = 1; |
37 |
| - const BREAK_COLUMN = 2; |
| 35 | + public const BREAK_NONE = 0; |
| 36 | + public const BREAK_ROW = 1; |
| 37 | + public const BREAK_COLUMN = 2; |
38 | 38 |
|
39 | 39 | // Sheet state
|
40 |
| - const SHEETSTATE_VISIBLE = 'visible'; |
41 |
| - const SHEETSTATE_HIDDEN = 'hidden'; |
42 |
| - const SHEETSTATE_VERYHIDDEN = 'veryHidden'; |
| 40 | + public const SHEETSTATE_VISIBLE = 'visible'; |
| 41 | + public const SHEETSTATE_HIDDEN = 'hidden'; |
| 42 | + public const SHEETSTATE_VERYHIDDEN = 'veryHidden'; |
| 43 | + |
| 44 | + protected const SHEET_NAME_REQUIRES_NO_QUOTES = '/^[_\p{L}][_\p{L}\p{N}]*$/mui'; |
43 | 45 |
|
44 | 46 | /**
|
45 | 47 | * Maximum 31 characters allowed for sheet title.
|
@@ -3037,7 +3039,11 @@ public function getHashCode()
|
3037 | 3039 | * Extract worksheet title from range.
|
3038 | 3040 | *
|
3039 | 3041 | * Example: extractSheetTitle("testSheet!A1") ==> 'A1'
|
| 3042 | + * Example: extractSheetTitle("testSheet!A1:C3") ==> 'A1:C3' |
3040 | 3043 | * Example: extractSheetTitle("'testSheet 1'!A1", true) ==> ['testSheet 1', 'A1'];
|
| 3044 | + * Example: extractSheetTitle("'testSheet 1'!A1:C3", true) ==> ['testSheet 1', 'A1:C3']; |
| 3045 | + * Example: extractSheetTitle("A1", true) ==> ['', 'A1']; |
| 3046 | + * Example: extractSheetTitle("A1:C3", true) ==> ['', 'A1:C3'] |
3041 | 3047 | *
|
3042 | 3048 | * @param string $range Range to extract title from
|
3043 | 3049 | * @param bool $returnRange Return range? (see example)
|
@@ -3436,4 +3442,9 @@ public function hasCodeName()
|
3436 | 3442 | {
|
3437 | 3443 | return $this->codeName !== null;
|
3438 | 3444 | }
|
| 3445 | + |
| 3446 | + public static function nameRequiresQuotes(string $sheetName): bool |
| 3447 | + { |
| 3448 | + return preg_match(self::SHEET_NAME_REQUIRES_NO_QUOTES, $sheetName) !== 1; |
| 3449 | + } |
3439 | 3450 | }
|
0 commit comments