Properties

$worksheet

$worksheet : \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

Worksheet to iterate.

Type

Worksheet

$onlyExistingCells

$onlyExistingCells : bool

Iterate only existing cells.

Type

bool

$currentColumnIndex

$currentColumnIndex : int

Current iterator position.

Type

int

$rowIndex

$rowIndex : int

Row index.

Type

int

$startColumnIndex

$startColumnIndex : int

Start position.

Type

int

$endColumnIndex

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

Create a new column iterator.

Parameters

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet

The worksheet to iterate over

int $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

Returns

mixed —

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

Returns

$this —

resetEnd()

resetEnd(string  $endColumn = null) : $this

(Re)Set the end column.

Parameters

string $endColumn

The column address at which to stop iterating

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

Returns

$this —

rewind()

rewind() : void

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() : void

Set the iterator to its next value.

prev()

prev() : void

Set the iterator to its previous value.

valid()

valid() : bool

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

Returns

bool —

getCurrentColumnIndex()

getCurrentColumnIndex() : int

Return the current iterator position.

Returns

int —

adjustForExistingOnlyRange()

adjustForExistingOnlyRange() : void

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