diff --git a/CHANGELOG.md b/CHANGELOG.md index 35d9d5cd..499ae3d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). - Fix handling for escaped enclosures and new lines in CSV Separator Inference - Fix MATCH an error was appearing when comparing strings against 0 (always true) +- Fix wrong calculation of highest column with specified row [#700](https://github.com/PHPOffice/PhpSpreadsheet/issues/700) - Fix VLOOKUP - Fix return type hint diff --git a/tests/PhpSpreadsheetTests/Collection/CellsTest.php b/tests/PhpSpreadsheetTests/Collection/CellsTest.php index be14aa5d..e1dcfc8f 100644 --- a/tests/PhpSpreadsheetTests/Collection/CellsTest.php +++ b/tests/PhpSpreadsheetTests/Collection/CellsTest.php @@ -114,4 +114,21 @@ class CellsTest extends TestCase $collection->add('A1', $cell); $collection->add('A2', $cell); } + + public function testGetHighestColumn() + { + $workbook = new Spreadsheet(); + $sheet = $workbook->getActiveSheet(); + $collection = $sheet->getCellCollection(); + + // check for empty sheet + $this->assertEquals('A', $collection->getHighestColumn()); + $this->assertEquals('A', $collection->getHighestColumn(1)); + + // set a value and check again + $sheet->getCell('C4')->setValue(1); + $this->assertEquals('C', $collection->getHighestColumn()); + $this->assertEquals('A', $collection->getHighestColumn(1)); + $this->assertEquals('C', $collection->getHighestColumn(4)); + } }