parent
0b387e767e
commit
5fe0a796c7
|
@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
- Fix handling of named ranges referencing sheets with spaces or "!" in their title
|
- Fix handling of named ranges referencing sheets with spaces or "!" in their title
|
||||||
- Cover `getSheetByName()` with tests for name with quote and spaces - [#739](https://github.com/PHPOffice/PhpSpreadsheet/issues/739)
|
- Cover `getSheetByName()` with tests for name with quote and spaces - [#739](https://github.com/PHPOffice/PhpSpreadsheet/issues/739)
|
||||||
- Best effort to support invalid colspan values in HTML reader - [878](https://github.com/PHPOffice/PhpSpreadsheet/pull/878)
|
- Best effort to support invalid colspan values in HTML reader - [878](https://github.com/PHPOffice/PhpSpreadsheet/pull/878)
|
||||||
|
- Fixes incorrect rows deletion [#868](https://github.com/PHPOffice/PhpSpreadsheet/issues/868)
|
||||||
|
|
||||||
## [1.8.2] - 2019-07-08
|
## [1.8.2] - 2019-07-08
|
||||||
|
|
||||||
|
|
|
@ -2115,6 +2115,10 @@ class Worksheet implements IComparable
|
||||||
public function removeRow($pRow, $pNumRows = 1)
|
public function removeRow($pRow, $pNumRows = 1)
|
||||||
{
|
{
|
||||||
if ($pRow >= 1) {
|
if ($pRow >= 1) {
|
||||||
|
for ($r = 0; $r < $pNumRows; ++$r) {
|
||||||
|
$this->getCellCollection()->removeRow($pRow + $r);
|
||||||
|
}
|
||||||
|
|
||||||
$highestRow = $this->getHighestDataRow();
|
$highestRow = $this->getHighestDataRow();
|
||||||
$objReferenceHelper = ReferenceHelper::getInstance();
|
$objReferenceHelper = ReferenceHelper::getInstance();
|
||||||
$objReferenceHelper->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this);
|
$objReferenceHelper->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this);
|
||||||
|
|
|
@ -161,4 +161,24 @@ class WorksheetTest extends TestCase
|
||||||
self::assertSame($expectTitle, $arRange[0]);
|
self::assertSame($expectTitle, $arRange[0]);
|
||||||
self::assertSame($expectCell2, $arRange[1]);
|
self::assertSame($expectCell2, $arRange[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix https://github.com/PHPOffice/PhpSpreadsheet/issues/868 when cells are not removed correctly
|
||||||
|
* on row deletion.
|
||||||
|
*/
|
||||||
|
public function testRemoveCellsCorrectlyWhenRemovingRow()
|
||||||
|
{
|
||||||
|
$workbook = new Spreadsheet();
|
||||||
|
$worksheet = $workbook->getActiveSheet();
|
||||||
|
$worksheet->getCell('A2')->setValue('A2');
|
||||||
|
$worksheet->getCell('C1')->setValue('C1');
|
||||||
|
$worksheet->removeRow(1);
|
||||||
|
$this->assertEquals(
|
||||||
|
'A2',
|
||||||
|
$worksheet->getCell('A1')->getValue()
|
||||||
|
);
|
||||||
|
$this->assertNull(
|
||||||
|
$worksheet->getCell('C1')->getValue()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue