81 $this->endRow =
$endRow ?: $this->worksheet->getHighestRow();
96 if ($this->onlyExistingCells && !($this->worksheet->cellExistsByColumnAndRow($this->columnIndex,
$row))) {
97 throw new PhpSpreadsheetException(
'In "IterateOnlyExistingCells" mode and Cell does not exist');
99 if (($row < $this->startRow) || (
$row > $this->endRow)) {
100 throw new PhpSpreadsheetException(
"Row $row is out of range ({$this->startRow} - {$this->endRow})");
102 $this->currentRow =
$row;
120 return $this->worksheet->getCellByColumnAndRow($this->columnIndex, $this->currentRow);
126 public function key(): int
139 ($this->onlyExistingCells) &&
140 (!$this->worksheet->cellExistsByColumnAndRow($this->columnIndex, $this->currentRow)) &&
141 ($this->currentRow <= $this->endRow)
153 ($this->onlyExistingCells) &&
154 (!$this->worksheet->cellExistsByColumnAndRow($this->columnIndex, $this->currentRow)) &&
155 ($this->currentRow >= $this->startRow)
164 return $this->currentRow <= $this->endRow && $this->currentRow >=
$this->startRow;
172 if ($this->onlyExistingCells) {
174 (!$this->worksheet->cellExistsByColumnAndRow($this->columnIndex, $this->startRow)) &&
175 ($this->startRow <= $this->endRow)
180 (!$this->worksheet->cellExistsByColumnAndRow($this->columnIndex, $this->endRow)) &&
181 ($this->endRow >= $this->startRow)
An exception for terminatinating execution or to throw for unit testing.
Helper class to manipulate cell coordinates.
static columnIndexFromString($pString)
Column index from string.
rewind()
Rewind the iterator to the starting row.
valid()
Indicate if more rows exist in the worksheet range of rows that we're iterating.
prev()
Set the iterator to its previous value.
current()
Return the current cell in this worksheet column.
seek(int $row=1)
Set the row pointer to the selected row.
key()
Return the current iterator key.
adjustForExistingOnlyRange()
Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary.
resetStart(int $startRow=1)
(Re)Set the start row and the current row pointer.
resetEnd($endRow=null)
(Re)Set the end row.
next()
Set the iterator to its next value.
__construct(?Worksheet $subject=null, $columnIndex='A', $startRow=1, $endRow=null)
Create a new row iterator.