Documentation

ColumnCellIterator 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.
$columnIndex  : int
Column index.
$currentRow  : int
Current iterator position.
$endRow  : int
End position.
$startRow  : int
Start position.

Methods

__construct()  : mixed
Create a new row iterator.
__destruct()  : mixed
Destructor.
current()  : Cell|null
Return the current cell in this worksheet column.
getIfNotExists()  : bool
getIterateOnlyExistingCells()  : bool
Get loop only existing cells.
key()  : int
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 row.
resetStart()  : $this
(Re)Set the start row and the current row pointer.
rewind()  : void
Rewind the iterator to the starting row.
seek()  : $this
Set the row pointer to the selected row.
setIfNotExists()  : void
setIterateOnlyExistingCells()  : void
Set the iterator to loop only existing cells.
valid()  : bool
Indicate if more rows exist in the worksheet range of rows 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

Methods

__construct()

Create a new row iterator.

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

The worksheet to iterate over

$columnIndex : string = 'A'

The column that we want to iterate

$startRow : int = 1

The row number at which to start iterating

$endRow : int|null = null

Optionally, the row number at which to stop iterating

$iterateOnlyExistingCells : bool = false

getIfNotExists()

public getIfNotExists() : bool
Return values
bool

getIterateOnlyExistingCells()

Get loop only existing cells.

public getIterateOnlyExistingCells() : bool
Return values
bool

resetEnd()

(Re)Set the end row.

public resetEnd([int|null $endRow = null ]) : $this
Parameters
$endRow : int|null = null

The row number at which to stop iterating

Return values
$this

resetStart()

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

public resetStart([int $startRow = 1 ]) : $this
Parameters
$startRow : int = 1

The row number at which to start iterating

Return values
$this

seek()

Set the row pointer to the selected row.

public seek([int $row = 1 ]) : $this
Parameters
$row : int = 1

The row number 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 rows exist in the worksheet range of rows 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