Properties

$worksheet

$worksheet : \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

Worksheet to iterate.

Type

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

$onlyExistingCells

$onlyExistingCells : boolean

Iterate only existing cells.

Type

boolean

$currentRow

$currentRow : integer

Current iterator position.

Type

integer

$columnIndex

$columnIndex : string

Column index.

Type

string

$startRow

$startRow : integer

Start position.

Type

integer

$endRow

$endRow : integer

End position.

Type

integer

Methods

__destruct()

__destruct() 

Destructor.

getIterateOnlyExistingCells()

getIterateOnlyExistingCells() : boolean

Get loop only existing cells.

Returns

boolean

setIterateOnlyExistingCells()

setIterateOnlyExistingCells(boolean  $value) 

Set the iterator to loop only existing cells.

Parameters

boolean $value

Throws

\PhpOffice\PhpSpreadsheet\Exception

__construct()

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

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

integer $startRow

The row number at which to start iterating

integer $endRow

Optionally, the row number at which to stop iterating

resetStart()

resetStart(integer  $startRow = 1) : $this

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

Parameters

integer $startRow

The row number at which to start iterating

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

$this

resetEnd()

resetEnd(integer  $endRow = null) : $this

(Re)Set the end row.

Parameters

integer $endRow

The row number at which to stop iterating

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

$this

seek()

seek(integer  $row = 1) : $this

Set the row pointer to the selected row.

Parameters

integer $row

The row number to set the current pointer at

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

$this

rewind()

rewind() 

Rewind the iterator to the starting row.

current()

current() : null|\PhpOffice\PhpSpreadsheet\Cell\Cell

Return the current cell in this worksheet column.

Returns

null|\PhpOffice\PhpSpreadsheet\Cell\Cell

key()

key() : integer

Return the current iterator key.

Returns

integer

next()

next() 

Set the iterator to its next value.

prev()

prev() 

Set the iterator to its previous value.

valid()

valid() : boolean

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

Returns

boolean

adjustForExistingOnlyRange()

adjustForExistingOnlyRange() 

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

Throws

\PhpOffice\PhpSpreadsheet\Exception