Properties

$worksheet

$worksheet : \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

Worksheet to iterate.

Type

Worksheet

$onlyExistingCells

$onlyExistingCells : bool

Iterate only existing cells.

Type

bool

$currentRow

$currentRow : int

Current iterator position.

Type

int

$columnIndex

$columnIndex : string

Column index.

Type

string

$startRow

$startRow : int

Start position.

Type

int

$endRow

$endRow : int

End position.

Type

int

Methods

__destruct()

__destruct() : mixed

Destructor.

Returns

mixed —

getIterateOnlyExistingCells()

getIterateOnlyExistingCells() : bool

Get loop only existing cells.

Returns

bool —

setIterateOnlyExistingCells()

setIterateOnlyExistingCells(bool  $value) : void

Set the iterator to loop only existing cells.

Parameters

bool $value

__construct()

__construct(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet  $subject = null, string  $columnIndex = 'A', int  $startRow = 1, int  $endRow = null) : mixed

Create a new row iterator.

Parameters

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $subject

The worksheet to iterate over

string $columnIndex

The column that we want to iterate

int $startRow

The row number at which to start iterating

int $endRow

Optionally, the row number at which to stop iterating

Returns

mixed —

resetStart()

resetStart(int  $startRow = 1) : $this

(Re)Set the start row and the current row pointer.

Parameters

int $startRow

The row number at which to start iterating

Returns

$this —

resetEnd()

resetEnd(int  $endRow = null) : $this

(Re)Set the end row.

Parameters

int $endRow

The row number at which to stop iterating

Returns

$this —

seek()

seek(int  $row = 1) : $this

Set the row pointer to the selected row.

Parameters

int $row

The row number to set the current pointer at

Returns

$this —

rewind()

rewind() : void

Rewind the iterator to the starting row.

current()

current() : ?\PhpOffice\PhpSpreadsheet\Cell\Cell

Return the current cell in this worksheet column.

Returns

?\PhpOffice\PhpSpreadsheet\Cell\Cell —

key()

key() : int

Return the current iterator key.

Returns

int —

next()

next() : void

Set the iterator to its next value.

prev()

prev() : void

Set the iterator to its previous value.

valid()

valid() : bool

Indicate if more rows exist in the worksheet range of rows that we're iterating.

Returns

bool —

adjustForExistingOnlyRange()

adjustForExistingOnlyRange() : void

Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary.