Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250620) (7d9030acd6e)
PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator Class Reference
Inheritance diagram for PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator:
PhpOffice\PhpSpreadsheet\Worksheet\CellIterator PhpOffice\PhpSpreadsheet\Worksheet\Iterator

Public Member Functions

 __construct (Worksheet $worksheet, string $columnIndex='A', int $startRow=1, ?int $endRow=null, bool $iterateOnlyExistingCells=false)
 Create a new row iterator.
 
 current ()
 Return the current cell in this worksheet column.
 
 getIfNotExists ()
 
 getIterateOnlyExistingCells ()
 Get loop only existing cells.
 
 key ()
 Return the current iterator key.
 
 next ()
 Set the iterator to its next value.
 
 prev ()
 Set the iterator to its previous value.
 
 resetEnd (?int $endRow=null)
 (Re)Set the end row.
 
 resetStart (int $startRow=1)
 (Re)Set the start row and the current row pointer.
 
 rewind ()
 Rewind the iterator to the starting row.
 
 seek (int $row=1)
 Set the row pointer to the selected row.
 
 setIfNotExists (bool $ifNotExists=self::IF_NOT_EXISTS_CREATE_NEW)
 
 setIterateOnlyExistingCells (bool $value)
 Set the iterator to loop only existing cells.
 
 valid ()
 Indicate if more rows exist in the worksheet range of rows that we're iterating.
 

Public Attributes

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

Protected Member Functions

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

Protected Attributes

Cells $cellCollection
 Cell Collection to iterate.
 
bool $ifNotExists = self::IF_NOT_EXISTS_CREATE_NEW
 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.
 
bool $onlyExistingCells = false
 Iterate only existing cells.
 
Worksheet $worksheet
 Worksheet to iterate.
 

Constructor & Destructor Documentation

◆ __construct()

PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::__construct ( Worksheet $worksheet,
string $columnIndex = 'A',
int $startRow = 1,
?int $endRow = null,
bool $iterateOnlyExistingCells = false )

Create a new row iterator.

Parameters
Worksheet$worksheetThe worksheet to iterate over
string$columnIndexThe column that we want to iterate
int$startRowThe row number at which to start iterating
?int$endRowOptionally, the row number at which to stop iterating

Member Function Documentation

◆ adjustForExistingOnlyRange()

PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::adjustForExistingOnlyRange ( )
protected

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

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\CellIterator.

◆ current()

PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::current ( )

Return the current cell in this worksheet column.

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\Iterator.

◆ key()

PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::key ( )

Return the current iterator key.

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\Iterator.

◆ next()

PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::next ( )

Set the iterator to its next value.

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\Iterator.

◆ resetEnd()

PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::resetEnd ( ?int $endRow = null)

(Re)Set the end row.

Parameters
?int$endRowThe row number at which to stop iterating
Return values
$this

◆ resetStart()

PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::resetStart ( int $startRow = 1)

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

Parameters
int$startRowThe row number at which to start iterating
Return values
$this

◆ rewind()

PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::rewind ( )

Rewind the iterator to the starting row.

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\Iterator.

◆ seek()

PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::seek ( int $row = 1)

Set the row pointer to the selected row.

Parameters
int$rowThe row number to set the current pointer at
Return values
$this

◆ valid()

PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::valid ( )

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

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\Iterator.


The documentation for this class was generated from the following file: