mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-30 20:18:00 +00:00
Update get cell logic in Cell Iterators
This commit is contained in:
@@ -120,7 +120,11 @@ class ColumnCellIterator extends CellIterator
|
||||
*/
|
||||
public function current(): ?Cell
|
||||
{
|
||||
return $this->worksheet->getCellByColumnAndRow($this->columnIndex, $this->currentRow);
|
||||
$cellAddress = Coordinate::stringFromColumnIndex($this->columnIndex) . $this->currentRow;
|
||||
|
||||
return $this->worksheet->getCellCollection()->has($cellAddress)
|
||||
? $this->worksheet->getCellCollection()->get($cellAddress)
|
||||
: $this->worksheet->createNewCell($cellAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -123,7 +123,11 @@ class RowCellIterator extends CellIterator
|
||||
*/
|
||||
public function current(): ?Cell
|
||||
{
|
||||
return $this->worksheet->getCellByColumnAndRow($this->currentColumnIndex, $this->rowIndex);
|
||||
$cellAddress = Coordinate::stringFromColumnIndex($this->currentColumnIndex) . $this->rowIndex;
|
||||
|
||||
return $this->worksheet->getCellCollection()->has($cellAddress)
|
||||
? $this->worksheet->getCellCollection()->get($cellAddress)
|
||||
: $this->worksheet->createNewCell($cellAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user