Properties

$worksheet

$worksheet : \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

Worksheet to iterate.

Type

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

$onlyExistingCells

$onlyExistingCells : boolean

Iterate only existing cells.

Type

boolean

$currentColumnIndex

$currentColumnIndex : integer

Current iterator position.

Type

integer

$rowIndex

$rowIndex : integer

Row index.

Type

integer

$startColumnIndex

$startColumnIndex : integer

Start position.

Type

integer

$endColumnIndex

$endColumnIndex : 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  $worksheet = null, integer  $rowIndex = 1, string  $startColumn = 'A', string  $endColumn = null) 

Create a new column iterator.

Parameters

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet

The worksheet to iterate over

integer $rowIndex

The row that we want to iterate

string $startColumn

The column address at which to start iterating

string $endColumn

Optionally, the column address at which to stop iterating

resetStart()

resetStart(string  $startColumn = 'A') : $this

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

Parameters

string $startColumn

The column address at which to start iterating

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

$this

resetEnd()

resetEnd(string  $endColumn = null) : $this

(Re)Set the end column.

Parameters

string $endColumn

The column address at which to stop iterating

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

$this

seek()

seek(string  $column = 'A') : $this

Set the column pointer to the selected column.

Parameters

string $column

The column address to set the current pointer at

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

$this

rewind()

rewind() 

Rewind the iterator to the starting column.

current()

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

Return the current cell in this worksheet row.

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell

key()

key() : string

Return the current iterator key.

Returns

string

next()

next() 

Set the iterator to its next value.

prev()

prev() 

Set the iterator to its previous value.

Throws

\PhpOffice\PhpSpreadsheet\Exception

valid()

valid() : boolean

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

Returns

boolean

getCurrentColumnIndex()

getCurrentColumnIndex() : integer

Return the current iterator position.

Returns

integer

adjustForExistingOnlyRange()

adjustForExistingOnlyRange() 

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

Throws

\PhpOffice\PhpSpreadsheet\Exception