diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b2b502c74..0c2ae9714a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). - Drop support for PHP 7.1, according to https://phpspreadsheet.readthedocs.io/en/latest/#php-version-support - Drop partial migration tool in favor of complete migration via RectorPHP [#1445](https://github.com/PHPOffice/PhpSpreadsheet/issues/1445) +- Cell Coordinate range now supports a space delimiter ## [1.12.0] - 2020-04-27 diff --git a/src/PhpSpreadsheet/Cell/Coordinate.php b/src/PhpSpreadsheet/Cell/Coordinate.php index cc0543f6ab..649a12dae3 100644 --- a/src/PhpSpreadsheet/Cell/Coordinate.php +++ b/src/PhpSpreadsheet/Cell/Coordinate.php @@ -131,7 +131,13 @@ public static function splitRange($pRange) $pRange = self::DEFAULT_RANGE; } - $exploded = explode(',', $pRange); + if (strpos(trim($pRange), ' ') !== false) { + $delimiter = ' '; + } else { + $delimiter = ','; + } + + $exploded = explode($delimiter, $pRange); $counter = count($exploded); for ($i = 0; $i < $counter; ++$i) { $exploded[$i] = explode(':', $exploded[$i]); diff --git a/tests/data/CellSplitRange.php b/tests/data/CellSplitRange.php index a7d701c3f2..ab72edff9f 100644 --- a/tests/data/CellSplitRange.php +++ b/tests/data/CellSplitRange.php @@ -29,4 +29,17 @@ ], 'B4:E9,H2:O11', ], + [ + [ + [ + 'B4', + 'E9', + ], + [ + 'H2', + 'O11', + ], + ], + 'B4:E9 H2:O11', + ], ];