Documentation

RowCellIterator extends CellIterator
in package

Tags
extends

CellIterator

Table of Contents

Constants

IF_NOT_EXISTS_CREATE_NEW  = true
IF_NOT_EXISTS_RETURN_NULL  = false
TREAT_EMPTY_STRING_AS_EMPTY_CELL  = 2
TREAT_NULL_VALUE_AS_EMPTY_CELL  = 1

Properties

$cellCollection  : Cells
Cell Collection to iterate.
$ifNotExists  : bool
If iterating all cells, and a cell doesn't exist, identifies whether a new cell should be created, or if the iterator should return a null value.
$onlyExistingCells  : bool
Iterate only existing cells.
$worksheet  : Worksheet
Worksheet to iterate.
$currentColumnIndex  : int
Current iterator position.
$endColumnIndex  : int
End position.
$rowIndex  : int
Row index.
$startColumnIndex  : int
Start position.

Methods

__construct()  : mixed
Create a new column iterator.
__destruct()  : mixed
Destructor.
current()  : Cell|null
Return the current cell in this worksheet row.
getCurrentColumnIndex()  : int
Return the current iterator position.
getIfNotExists()  : bool
getIterateOnlyExistingCells()  : bool
Get loop only existing cells.
key()  : string
Return the current iterator key.
next()  : void
Set the iterator to its next value.
prev()  : void
Set the iterator to its previous value.
resetEnd()  : $this
(Re)Set the end column.
resetStart()  : $this
(Re)Set the start column and the current column pointer.
rewind()  : void
Rewind the iterator to the starting column.
seek()  : $this
Set the column pointer to the selected column.
setIfNotExists()  : void
setIterateOnlyExistingCells()  : void
Set the iterator to loop only existing cells.
valid()  : bool
Indicate if more columns exist in the worksheet range of columns that we're iterating.
adjustForExistingOnlyRange()  : void
Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary.

Constants

IF_NOT_EXISTS_CREATE_NEW

public mixed IF_NOT_EXISTS_CREATE_NEW = true

IF_NOT_EXISTS_RETURN_NULL

public mixed IF_NOT_EXISTS_RETURN_NULL = false

TREAT_EMPTY_STRING_AS_EMPTY_CELL

public mixed TREAT_EMPTY_STRING_AS_EMPTY_CELL = 2

TREAT_NULL_VALUE_AS_EMPTY_CELL

public mixed TREAT_NULL_VALUE_AS_EMPTY_CELL = 1

Properties

$ifNotExists

If iterating all cells, and a cell doesn't exist, identifies whether a new cell should be created, or if the iterator should return a null value.

protected bool $ifNotExists = self::IF_NOT_EXISTS_CREATE_NEW

$onlyExistingCells

Iterate only existing cells.

protected bool $onlyExistingCells = false

$currentColumnIndex

Current iterator position.

private int $currentColumnIndex

Methods

__construct()

Create a new column iterator.

public __construct(Worksheet $worksheet[, int $rowIndex = 1 ][, string $startColumn = 'A' ][, string|null $endColumn = null ][, bool $iterateOnlyExistingCells = false ]) : mixed
Parameters
$worksheet : Worksheet

The worksheet to iterate over

$rowIndex : int = 1

The row that we want to iterate

$startColumn : string = 'A'

The column address at which to start iterating

$endColumn : string|null = null

Optionally, the column address at which to stop iterating

$iterateOnlyExistingCells : bool = false

current()

Return the current cell in this worksheet row.

public current() : Cell|null
Return values
Cell|null

getCurrentColumnIndex()

Return the current iterator position.

public getCurrentColumnIndex() : int
Return values
int

getIfNotExists()

public getIfNotExists() : bool
Return values
bool

getIterateOnlyExistingCells()

Get loop only existing cells.

public getIterateOnlyExistingCells() : bool
Return values
bool

key()

Return the current iterator key.

public key() : string
Return values
string

prev()

Set the iterator to its previous value.

public prev() : void

resetEnd()

(Re)Set the end column.

public resetEnd([string|null $endColumn = null ]) : $this
Parameters
$endColumn : string|null = null

The column address at which to stop iterating

Return values
$this

resetStart()

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

public resetStart([string $startColumn = 'A' ]) : $this
Parameters
$startColumn : string = 'A'

The column address at which to start iterating

Return values
$this

rewind()

Rewind the iterator to the starting column.

public rewind() : void

seek()

Set the column pointer to the selected column.

public seek([string $column = 'A' ]) : $this
Parameters
$column : string = 'A'

The column address to set the current pointer at

Return values
$this

setIfNotExists()

public setIfNotExists([bool $ifNotExists = self::IF_NOT_EXISTS_CREATE_NEW ]) : void
Parameters
$ifNotExists : bool = self::IF_NOT_EXISTS_CREATE_NEW

setIterateOnlyExistingCells()

Set the iterator to loop only existing cells.

public setIterateOnlyExistingCells(bool $value) : void
Parameters
$value : bool

valid()

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

public valid() : bool
Return values
bool

adjustForExistingOnlyRange()

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

protected adjustForExistingOnlyRange() : void

        
On this page

Search results