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

Public Member Functions

 __construct (Worksheet $worksheet, int $rowIndex=1, string $startColumn='A', ?string $endColumn=null, bool $iterateOnlyExistingCells=false)
 Create a new column iterator.
 
 current ()
 Return the current cell in this worksheet row.
 
 getCurrentColumnIndex ()
 Return the current iterator position.
 
 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 (?string $endColumn=null)
 (Re)Set the end column.
 
 resetStart (string $startColumn='A')
 (Re)Set the start column and the current column pointer.
 
 rewind ()
 Rewind the iterator to the starting column.
 
 seek (string $column='A')
 Set the column pointer to the selected column.
 
 setIfNotExists (bool $ifNotExists=self::IF_NOT_EXISTS_CREATE_NEW)
 
 setIterateOnlyExistingCells (bool $value)
 Set the iterator to loop only existing cells.
 
 valid ()
 Indicate if more columns exist in the worksheet range of columns 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\RowCellIterator::__construct ( Worksheet $worksheet,
int $rowIndex = 1,
string $startColumn = 'A',
?string $endColumn = null,
bool $iterateOnlyExistingCells = false )

Create a new column iterator.

Parameters
Worksheet$worksheetThe worksheet to iterate over
int$rowIndexThe row that we want to iterate
string$startColumnThe column address at which to start iterating
?string$endColumnOptionally, the column address at which to stop iterating

Member Function Documentation

◆ adjustForExistingOnlyRange()

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

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

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\CellIterator.

◆ current()

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

Return the current cell in this worksheet row.

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\Iterator.

◆ key()

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

Return the current iterator key.

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\Iterator.

◆ next()

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

Set the iterator to its next value.

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\Iterator.

◆ resetEnd()

PhpOffice\PhpSpreadsheet\Worksheet\RowCellIterator::resetEnd ( ?string $endColumn = null)

(Re)Set the end column.

Parameters
?string$endColumnThe column address at which to stop iterating
Return values
$this

◆ resetStart()

PhpOffice\PhpSpreadsheet\Worksheet\RowCellIterator::resetStart ( string $startColumn = 'A')

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

Parameters
string$startColumnThe column address at which to start iterating
Return values
$this

◆ rewind()

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

Rewind the iterator to the starting column.

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\Iterator.

◆ seek()

PhpOffice\PhpSpreadsheet\Worksheet\RowCellIterator::seek ( string $column = 'A')

Set the column pointer to the selected column.

Parameters
string$columnThe column address to set the current pointer at
Return values
$this

◆ valid()

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

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

Reimplemented from PhpOffice\PhpSpreadsheet\Worksheet\Iterator.


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