mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-18 22:16:46 +00:00
72b77020e4
* 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
33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?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();
|
|
}
|
|
}
|