-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add iterateOnlyExistingCells to Constructors (#3727)
* Add iterateOnlyExistingCells to Constructors Fix #3721. That issue can already be handled, but requires several statements when one ought to suffice. Adding an extra parameter to the RowCellIterator and ColumnCellIterator constructors is useful, easy, and becomes especially practical now that our supported Php releases all support named parameters (see new test Issue3721Test). * Update Column.php * Update .php-cs-fixer.dist.php * Update Row.php * Update Column.php * Update ByColumnAndRowTest.php
- Loading branch information
Showing
8 changed files
with
50 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpSpreadsheetTests\Reader\Ods; | ||
|
||
use PhpOffice\PhpSpreadsheet\Reader\Ods; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class Issue3721Test extends TestCase | ||
{ | ||
public function testIssue2810(): void | ||
{ | ||
// Problems with getHighestDataColumn | ||
$filename = 'tests/data/Reader/Ods/issue.3721.ods'; | ||
$reader = new Ods(); | ||
$spreadsheet = $reader->load($filename); | ||
$sheet = $spreadsheet->getSheetByNameOrThrow('sheet with data'); | ||
$origHigh = $sheet->getHighestDataColumn(); | ||
self::assertSame('C', $origHigh); | ||
$cells = []; | ||
foreach ($sheet->getRowIterator() as $row) { | ||
foreach ($row->getCellIterator(iterateOnlyExistingCells: true) as $cell) { | ||
$cells[] = $cell->getCoordinate(); | ||
} | ||
} | ||
self::assertSame(['A1', 'B1', 'C1', 'A2', 'B2', 'C2'], $cells); | ||
self::assertSame('C', $sheet->getHighestDataColumn()); | ||
self::assertSame('BL', $sheet->getHighestColumn()); | ||
$spreadsheet->disconnectWorksheets(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.