Select correct cell when calling freezePane
Fixes a bug when calling `$sheet->freezePane('B2')` without a second argument. The selected cell will now be `B2` instead of the incorrect `B3`. Fixes #389 Closes #393
This commit is contained in:
parent
a089a87671
commit
bdc95b14bf
|
@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
- Use proper € symbol for currency format - [#379](https://github.com/PHPOffice/PhpSpreadsheet/pull/379)
|
||||
- Read printing area correctly when skipping some sheets - [#371](https://github.com/PHPOffice/PhpSpreadsheet/issues/371)
|
||||
- Avoid incorrectly overwriting calculated value type - [#394](https://github.com/PHPOffice/PhpSpreadsheet/issues/394)
|
||||
- Select correct cell when calling freezePane - [#389](https://github.com/PHPOffice/PhpSpreadsheet/issues/389)
|
||||
|
||||
## [1.1.0] - 2018-01-28
|
||||
|
||||
|
|
|
@ -1971,7 +1971,7 @@ class Worksheet implements IComparable
|
|||
*
|
||||
* - A2 will freeze the rows above cell A2 (i.e row 1)
|
||||
* - B1 will freeze the columns to the left of cell B1 (i.e column A)
|
||||
* - B2 will freeze the rows above and to the left of cell A2 (i.e row 1 and column A)
|
||||
* - B2 will freeze the rows above and to the left of cell B2 (i.e row 1 and column A)
|
||||
*
|
||||
* @param null|string $cell Position of the split
|
||||
* @param null|string $topLeftCell default position of the right bottom pane
|
||||
|
@ -1988,7 +1988,7 @@ class Worksheet implements IComparable
|
|||
|
||||
if ($cell !== null && $topLeftCell === null) {
|
||||
$coordinate = Coordinate::coordinateFromString($cell);
|
||||
$topLeftCell = $coordinate[0] . ($coordinate[1] + 1);
|
||||
$topLeftCell = $coordinate[0] . $coordinate[1];
|
||||
}
|
||||
|
||||
$this->freezePane = $cell;
|
||||
|
|
|
@ -123,4 +123,11 @@ class WorksheetTest extends TestCase
|
|||
$sheet->setCodeName('Test Code Name', false);
|
||||
self::assertSame('Test Code Name', $sheet->getCodeName());
|
||||
}
|
||||
|
||||
public function testFreezePaneSelectedCell()
|
||||
{
|
||||
$worksheet = new Worksheet();
|
||||
$worksheet->freezePane('B2');
|
||||
self::assertSame('B2', $worksheet->getTopLeftCell());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue