Merge pull request #2988 from PHPOffice/Issue-2987_NamedCell-UTF8-Worksheet-getCell
cellExists() and getCell() methods should support UTF-8 named cells
This commit is contained in:
commit
630d92f0f4
|
|
@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fully flatten an array [Issue #2955](https://github.com/PHPOffice/PhpSpreadsheet/issues/2955) [PR #2956](https://github.com/PHPOffice/PhpSpreadsheet/pull/2956)
|
- Fully flatten an array [Issue #2955](https://github.com/PHPOffice/PhpSpreadsheet/issues/2955) [PR #2956](https://github.com/PHPOffice/PhpSpreadsheet/pull/2956)
|
||||||
|
- cellExists() and getCell() methods should support UTF-8 named cells [Issue #2987](https://github.com/PHPOffice/PhpSpreadsheet/issues/2987) [PR #2988](https://github.com/PHPOffice/PhpSpreadsheet/pull/2988)
|
||||||
|
|
||||||
## 1.24.1 - 2022-07-18
|
## 1.24.1 - 2022-07-18
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1265,7 +1265,7 @@ class Worksheet implements IComparable
|
||||||
}
|
}
|
||||||
} elseif (
|
} elseif (
|
||||||
!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $coordinate) &&
|
!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $coordinate) &&
|
||||||
preg_match('/^' . Calculation::CALCULATION_REGEXP_DEFINEDNAME . '$/i', $coordinate)
|
preg_match('/^' . Calculation::CALCULATION_REGEXP_DEFINEDNAME . '$/iu', $coordinate)
|
||||||
) {
|
) {
|
||||||
// Named range?
|
// Named range?
|
||||||
$namedRange = $this->validateNamedRange($coordinate, true);
|
$namedRange = $this->validateNamedRange($coordinate, true);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,15 @@ class WorksheetNamedRangesTest extends TestCase
|
||||||
self::assertTrue($cellExists);
|
self::assertTrue($cellExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCellExistsUtf8(): void
|
||||||
|
{
|
||||||
|
$namedCell = 'Χαιρετισμός';
|
||||||
|
|
||||||
|
$worksheet = $this->spreadsheet->getActiveSheet();
|
||||||
|
$cellExists = $worksheet->cellExists($namedCell);
|
||||||
|
self::assertTrue($cellExists);
|
||||||
|
}
|
||||||
|
|
||||||
public function testCellNotExists(): void
|
public function testCellNotExists(): void
|
||||||
{
|
{
|
||||||
$namedCell = 'GOODBYE';
|
$namedCell = 'GOODBYE';
|
||||||
|
|
@ -67,6 +76,15 @@ class WorksheetNamedRangesTest extends TestCase
|
||||||
self::assertSame('Hello', $cell->getValue());
|
self::assertSame('Hello', $cell->getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetCellUtf8(): void
|
||||||
|
{
|
||||||
|
$namedCell = 'Χαιρετισμός';
|
||||||
|
|
||||||
|
$worksheet = $this->spreadsheet->getActiveSheet();
|
||||||
|
$cell = $worksheet->getCell($namedCell);
|
||||||
|
self::assertSame('नमस्ते', $cell->getValue());
|
||||||
|
}
|
||||||
|
|
||||||
public function testGetCellNotExists(): void
|
public function testGetCellNotExists(): void
|
||||||
{
|
{
|
||||||
$namedCell = 'GOODBYE';
|
$namedCell = 'GOODBYE';
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue