ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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)
 Create a new row iterator. More...
 
 __destruct ()
 Destructor. More...
 
 resetStart ($startRow=1)
 (Re)Set the start row and the current row pointer More...
 
 resetEnd ($endRow=null)
 (Re)Set the end row More...
 
 seek ($row=1)
 Set the row pointer to the selected row. More...
 
 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)
 Set the iterator to loop only existing cells. More...
 

Protected Member Functions

 adjustForExistingOnlyRange ()
 Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary. More...
 
- Protected Member Functions inherited from PHPExcel_Worksheet_CellIterator
 adjustForExistingOnlyRange ()
 Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary. More...
 

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.

Parameters
PHPExcel_Worksheet$subjectThe worksheet to iterate over
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.

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

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  }
resetStart($startRow=1)
(Re)Set the start row and the current row pointer
static columnIndexFromString($pString='A')
Column index from string.
Definition: Cell.php:782
resetEnd($endRow=null)
(Re)Set the end row
+ Here is the call graph for this function:

◆ __destruct()

PHPExcel_Worksheet_ColumnCellIterator::__destruct ( )

Destructor.

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

Definition at line 196 of file ColumnCellIterator.php.

References $_endRow, and $_startRow.

Referenced by resetEnd(), and resetStart().

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)) {
207  --$this->_endRow;
208  }
209  if ($this->_endRow < $this->_startRow) {
210  throw new PHPExcel_Exception('No cells exist within the specified range');
211  }
212  }
213  }
+ 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.

152  {
153  return $this->_position;
154  }

◆ next()

PHPExcel_Worksheet_ColumnCellIterator::next ( )

Set the iterator to its next value.

Definition at line 159 of file ColumnCellIterator.php.

References PHPExcel_Worksheet_CellIterator\$_position.

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

◆ prev()

PHPExcel_Worksheet_ColumnCellIterator::prev ( )

Set the iterator to its previous value.

Definition at line 170 of file ColumnCellIterator.php.

References PHPExcel_Worksheet_CellIterator\$_position.

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  }

◆ resetEnd()

PHPExcel_Worksheet_ColumnCellIterator::resetEnd (   $endRow = null)

(Re)Set the end row

Parameters
integer$endRowThe row number at which to stop iterating
Returns
PHPExcel_Worksheet_ColumnCellIterator
Exceptions
PHPExcel_Exception

Definition at line 106 of file ColumnCellIterator.php.

References adjustForExistingOnlyRange().

Referenced by __construct().

106  {
107  $this->_endRow = ($endRow) ? $endRow : $this->_subject->getHighestRow();
109 
110  return $this;
111  }
adjustForExistingOnlyRange()
Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary.
+ 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

Parameters
integer$startRowThe row number at which to start iterating
Returns
PHPExcel_Worksheet_ColumnCellIterator
Exceptions
PHPExcel_Exception

Definition at line 91 of file ColumnCellIterator.php.

References adjustForExistingOnlyRange(), and seek().

Referenced by __construct().

91  {
92  $this->_startRow = $startRow;
94  $this->seek($startRow);
95 
96  return $this;
97  }
seek($row=1)
Set the row pointer to the selected row.
adjustForExistingOnlyRange()
Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary.
+ 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.

References $_startRow.

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

◆ seek()

PHPExcel_Worksheet_ColumnCellIterator::seek (   $row = 1)

Set the row pointer to the selected row.

Parameters
integer$rowThe row number to set the current pointer at
Returns
PHPExcel_Worksheet_ColumnCellIterator
Exceptions
PHPExcel_Exception

Definition at line 120 of file ColumnCellIterator.php.

References $row.

Referenced by resetStart().

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  }
+ 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.

References $_endRow.

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

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: