ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PHPExcel_Worksheet_ColumnCellIterator Class Reference
+ Inheritance diagram for PHPExcel_Worksheet_ColumnCellIterator:
+ Collaboration diagram for PHPExcel_Worksheet_ColumnCellIterator:

Public Member Functions

 __construct (PHPExcel_Worksheet $subject=null, $columnIndex, $startRow=1, $endRow=null)
 
 __destruct ()
 Destructor. More...
 
 resetStart ($startRow=1)
 
 resetEnd ($endRow=null)
 
 seek ($row=1)
 
 rewind ()
 Rewind the iterator to the starting row. More...
 
 current ()
 Return the current cell in this worksheet column. More...
 
 key ()
 Return the current iterator key. More...
 
 next ()
 Set the iterator to its next value. More...
 
 prev ()
 Set the iterator to its previous value. More...
 
 valid ()
 Indicate if more rows exist in the worksheet range of rows that we're iterating. More...
 
- Public Member Functions inherited from PHPExcel_Worksheet_CellIterator
 __destruct ()
 Destructor. More...
 
 getIterateOnlyExistingCells ()
 Get loop only existing cells. More...
 
 setIterateOnlyExistingCells ($value=true)
 

Protected Member Functions

 adjustForExistingOnlyRange ()
 
 adjustForExistingOnlyRange ()
 

Protected Attributes

 $_columnIndex
 
 $_startRow = 1
 
 $_endRow = 1
 
- Protected Attributes inherited from PHPExcel_Worksheet_CellIterator
 $_subject
 
 $_position = null
 
 $_onlyExistingCells = false
 

Detailed Description

Definition at line 38 of file ColumnCellIterator.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Worksheet_ColumnCellIterator::__construct ( PHPExcel_Worksheet  $subject = null,
  $columnIndex,
  $startRow = 1,
  $endRow = null 
)
Create a new row iterator

@param      PHPExcel_Worksheet      $subject            The worksheet to iterate over
Parameters
string$columnIndexThe column that we want to iterate
integer$startRowThe row number at which to start iterating
integer$endRowOptionally, the row number at which to stop iterating

Definition at line 69 of file ColumnCellIterator.php.

69 {
70 // Set subject
71 $this->_subject = $subject;
72 $this->_columnIndex = PHPExcel_Cell::columnIndexFromString($columnIndex) - 1;
73 $this->resetEnd($endRow);
74 $this->resetStart($startRow);
75 }
static columnIndexFromString($pString='A')
Column index from string.
Definition: Cell.php:782

References PHPExcel_Cell\columnIndexFromString(), resetEnd(), and resetStart().

+ Here is the call graph for this function:

◆ __destruct()

PHPExcel_Worksheet_ColumnCellIterator::__destruct ( )

Destructor.

Reimplemented from PHPExcel_Worksheet_CellIterator.

Definition at line 80 of file ColumnCellIterator.php.

80 {
81 unset($this->_subject);
82 }

Member Function Documentation

◆ adjustForExistingOnlyRange()

PHPExcel_Worksheet_ColumnCellIterator::adjustForExistingOnlyRange ( )
protected
Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
Exceptions
PHPExcel_Exception

Reimplemented from PHPExcel_Worksheet_CellIterator.

Definition at line 196 of file ColumnCellIterator.php.

196 {
197 if ($this->_onlyExistingCells) {
198 while ((!$this->_subject->cellExistsByColumnAndRow($this->_columnIndex, $this->_startRow)) &&
199 ($this->_startRow <= $this->_endRow)) {
201 }
202 if ($this->_startRow > $this->_endRow) {
203 throw new PHPExcel_Exception('No cells exist within the specified range');
204 }
205 while ((!$this->_subject->cellExistsByColumnAndRow($this->_columnIndex, $this->_endRow)) &&
206 ($this->_endRow >= $this->_startRow)) {
208 }
209 if ($this->_endRow < $this->_startRow) {
210 throw new PHPExcel_Exception('No cells exist within the specified range');
211 }
212 }
213 }

References $_endRow, and $_startRow.

Referenced by resetEnd(), and resetStart().

+ Here is the caller graph for this function:

◆ current()

PHPExcel_Worksheet_ColumnCellIterator::current ( )

Return the current cell in this worksheet column.

Returns
PHPExcel_Worksheet_Row

Definition at line 143 of file ColumnCellIterator.php.

143 {
144 return $this->_subject->getCellByColumnAndRow($this->_columnIndex, $this->_position);
145 }

◆ key()

PHPExcel_Worksheet_ColumnCellIterator::key ( )

Return the current iterator key.

Returns
int

Definition at line 152 of file ColumnCellIterator.php.

References PHPExcel_Worksheet_CellIterator\$_position.

◆ next()

PHPExcel_Worksheet_ColumnCellIterator::next ( )

Set the iterator to its next value.

Definition at line 159 of file ColumnCellIterator.php.

159 {
160 do {
162 } while (($this->_onlyExistingCells) &&
163 (!$this->_subject->cellExistsByColumnAndRow($this->_columnIndex, $this->_position)) &&
164 ($this->_position <= $this->_endRow));
165 }

References PHPExcel_Worksheet_CellIterator\$_position.

◆ prev()

PHPExcel_Worksheet_ColumnCellIterator::prev ( )

Set the iterator to its previous value.

Definition at line 170 of file ColumnCellIterator.php.

170 {
171 if ($this->_position <= $this->_startRow) {
172 throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->_startRow} - {$this->_endRow})");
173 }
174
175 do {
177 } while (($this->_onlyExistingCells) &&
178 (!$this->_subject->cellExistsByColumnAndRow($this->_columnIndex, $this->_position)) &&
179 ($this->_position >= $this->_startRow));
180 }

References PHPExcel_Worksheet_CellIterator\$_position.

◆ resetEnd()

PHPExcel_Worksheet_ColumnCellIterator::resetEnd (   $endRow = null)
(Re)Set the end row

@param integer      $endRow The row number at which to stop iterating
Returns
PHPExcel_Worksheet_ColumnCellIterator
Exceptions
PHPExcel_Exception

Definition at line 106 of file ColumnCellIterator.php.

106 {
107 $this->_endRow = ($endRow) ? $endRow : $this->_subject->getHighestRow();
109
110 return $this;
111 }

References adjustForExistingOnlyRange().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetStart()

PHPExcel_Worksheet_ColumnCellIterator::resetStart (   $startRow = 1)
(Re)Set the start row and the current row pointer

@param integer      $startRow       The row number at which to start iterating
Returns
PHPExcel_Worksheet_ColumnCellIterator
Exceptions
PHPExcel_Exception

Definition at line 91 of file ColumnCellIterator.php.

91 {
92 $this->_startRow = $startRow;
94 $this->seek($startRow);
95
96 return $this;
97 }

References adjustForExistingOnlyRange(), and seek().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rewind()

PHPExcel_Worksheet_ColumnCellIterator::rewind ( )

Rewind the iterator to the starting row.

Definition at line 134 of file ColumnCellIterator.php.

134 {
135 $this->_position = $this->_startRow;
136 }

References $_startRow.

◆ seek()

PHPExcel_Worksheet_ColumnCellIterator::seek (   $row = 1)
Set the row pointer to the selected row

@param integer      $row    The row number to set the current pointer at
Returns
PHPExcel_Worksheet_ColumnCellIterator
Exceptions
PHPExcel_Exception

Definition at line 120 of file ColumnCellIterator.php.

120 {
121 if (($row < $this->_startRow) || ($row > $this->_endRow)) {
122 throw new PHPExcel_Exception("Row $row is out of range ({$this->_startRow} - {$this->_endRow})");
123 } elseif ($this->_onlyExistingCells && !($this->_subject->cellExistsByColumnAndRow($this->_columnIndex, $row))) {
124 throw new PHPExcel_Exception('In "IterateOnlyExistingCells" mode and Cell does not exist');
125 }
126 $this->_position = $row;
127
128 return $this;
129 }

References $row.

Referenced by resetStart().

+ Here is the caller graph for this function:

◆ valid()

PHPExcel_Worksheet_ColumnCellIterator::valid ( )

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

Returns
boolean

Definition at line 187 of file ColumnCellIterator.php.

187 {
188 return $this->_position <= $this->_endRow;
189 }

References $_endRow.

Field Documentation

◆ $_columnIndex

PHPExcel_Worksheet_ColumnCellIterator::$_columnIndex
protected

Definition at line 45 of file ColumnCellIterator.php.

◆ $_endRow

PHPExcel_Worksheet_ColumnCellIterator::$_endRow = 1
protected

Definition at line 59 of file ColumnCellIterator.php.

Referenced by adjustForExistingOnlyRange(), and valid().

◆ $_startRow

PHPExcel_Worksheet_ColumnCellIterator::$_startRow = 1
protected

Definition at line 52 of file ColumnCellIterator.php.

Referenced by adjustForExistingOnlyRange(), and rewind().


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