ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PHPExcel_Worksheet_RowCellIterator Class Reference
+ Inheritance diagram for PHPExcel_Worksheet_RowCellIterator:
+ Collaboration diagram for PHPExcel_Worksheet_RowCellIterator:

Public Member Functions

 __construct (PHPExcel_Worksheet $subject=null, $rowIndex=1, $startColumn='A', $endColumn=null)
 Create a new column iterator. More...
 
 __destruct ()
 Destructor. More...
 
 resetStart ($startColumn='A')
 (Re)Set the start column and the current column pointer More...
 
 resetEnd ($endColumn=null)
 (Re)Set the end column More...
 
 seek ($column='A')
 Set the column pointer to the selected column. More...
 
 rewind ()
 Rewind the iterator to the starting column. More...
 
 current ()
 Return the current cell in this worksheet row. 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 columns exist in the worksheet range of columns 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

 $_rowIndex
 
 $_startColumn = 0
 
 $_endColumn = 0
 
- Protected Attributes inherited from PHPExcel_Worksheet_CellIterator
 $_subject
 
 $_position = null
 
 $_onlyExistingCells = false
 

Detailed Description

Definition at line 38 of file RowCellIterator.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Worksheet_RowCellIterator::__construct ( PHPExcel_Worksheet  $subject = null,
  $rowIndex = 1,
  $startColumn = 'A',
  $endColumn = null 
)

Create a new column iterator.

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

Definition at line 69 of file RowCellIterator.php.

References resetEnd(), and resetStart().

69  {
70  // Set subject and row index
71  $this->_subject = $subject;
72  $this->_rowIndex = $rowIndex;
73  $this->resetEnd($endColumn);
74  $this->resetStart($startColumn);
75  }
resetEnd($endColumn=null)
(Re)Set the end column
resetStart($startColumn='A')
(Re)Set the start column and the current column pointer
+ Here is the call graph for this function:

◆ __destruct()

PHPExcel_Worksheet_RowCellIterator::__destruct ( )

Destructor.

Definition at line 80 of file RowCellIterator.php.

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

Member Function Documentation

◆ adjustForExistingOnlyRange()

PHPExcel_Worksheet_RowCellIterator::adjustForExistingOnlyRange ( )
protected

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

Exceptions
PHPExcel_Exception

Definition at line 205 of file RowCellIterator.php.

References $_endColumn, and $_startColumn.

Referenced by resetEnd(), and resetStart().

205  {
206  if ($this->_onlyExistingCells) {
207  while ((!$this->_subject->cellExistsByColumnAndRow($this->_startColumn, $this->_rowIndex)) &&
208  ($this->_startColumn <= $this->_endColumn)) {
210  }
211  if ($this->_startColumn > $this->_endColumn) {
212  throw new PHPExcel_Exception('No cells exist within the specified range');
213  }
214  while ((!$this->_subject->cellExistsByColumnAndRow($this->_endColumn, $this->_rowIndex)) &&
215  ($this->_endColumn >= $this->_startColumn)) {
217  }
218  if ($this->_endColumn < $this->_startColumn) {
219  throw new PHPExcel_Exception('No cells exist within the specified range');
220  }
221  }
222  }
+ Here is the caller graph for this function:

◆ current()

PHPExcel_Worksheet_RowCellIterator::current ( )

Return the current cell in this worksheet row.

Returns
PHPExcel_Cell

Definition at line 146 of file RowCellIterator.php.

146  {
147  return $this->_subject->getCellByColumnAndRow($this->_position, $this->_rowIndex);
148  }

◆ key()

PHPExcel_Worksheet_RowCellIterator::key ( )

Return the current iterator key.

Returns
string

Definition at line 155 of file RowCellIterator.php.

References PHPExcel_Cell\stringFromColumnIndex().

155  {
156  return PHPExcel_Cell::stringFromColumnIndex($this->_position);
157  }
static stringFromColumnIndex($pColumnIndex=0)
String from columnindex.
Definition: Cell.php:825
+ Here is the call graph for this function:

◆ next()

PHPExcel_Worksheet_RowCellIterator::next ( )

Set the iterator to its next value.

Definition at line 162 of file RowCellIterator.php.

References PHPExcel_Worksheet_CellIterator\$_position.

162  {
163  do {
165  } while (($this->_onlyExistingCells) &&
166  (!$this->_subject->cellExistsByColumnAndRow($this->_position, $this->_rowIndex)) &&
167  ($this->_position <= $this->_endColumn));
168  }

◆ prev()

PHPExcel_Worksheet_RowCellIterator::prev ( )

Set the iterator to its previous value.

Exceptions
PHPExcel_Exception

Definition at line 175 of file RowCellIterator.php.

References PHPExcel_Worksheet_CellIterator\$_position, and PHPExcel_Cell\stringFromColumnIndex().

175  {
176  if ($this->_position <= $this->_startColumn) {
177  throw new PHPExcel_Exception(
178  "Column is already at the beginning of range (" .
179  PHPExcel_Cell::stringFromColumnIndex($this->_endColumn) . " - " .
180  PHPExcel_Cell::stringFromColumnIndex($this->_endColumn) . ")"
181  );
182  }
183 
184  do {
186  } while (($this->_onlyExistingCells) &&
187  (!$this->_subject->cellExistsByColumnAndRow($this->_position, $this->_rowIndex)) &&
188  ($this->_position >= $this->_startColumn));
189  }
static stringFromColumnIndex($pColumnIndex=0)
String from columnindex.
Definition: Cell.php:825
+ Here is the call graph for this function:

◆ resetEnd()

PHPExcel_Worksheet_RowCellIterator::resetEnd (   $endColumn = null)

(Re)Set the end column

Parameters
string$endColumnThe column address at which to stop iterating
Returns
PHPExcel_Worksheet_RowCellIterator
Exceptions
PHPExcel_Exception

Definition at line 107 of file RowCellIterator.php.

References adjustForExistingOnlyRange(), and PHPExcel_Cell\columnIndexFromString().

Referenced by __construct().

107  {
108  $endColumn = ($endColumn) ? $endColumn : $this->_subject->getHighestColumn();
109  $this->_endColumn = PHPExcel_Cell::columnIndexFromString($endColumn) - 1;
111 
112  return $this;
113  }
adjustForExistingOnlyRange()
Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary.
static columnIndexFromString($pString='A')
Column index from string.
Definition: Cell.php:782
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetStart()

PHPExcel_Worksheet_RowCellIterator::resetStart (   $startColumn = 'A')

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

Parameters
integer$startColumnThe column address at which to start iterating
Returns
PHPExcel_Worksheet_RowCellIterator
Exceptions
PHPExcel_Exception

Definition at line 91 of file RowCellIterator.php.

References adjustForExistingOnlyRange(), PHPExcel_Cell\columnIndexFromString(), seek(), and PHPExcel_Cell\stringFromColumnIndex().

Referenced by __construct().

91  {
92  $startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1;
93  $this->_startColumn = $startColumnIndex;
95  $this->seek(PHPExcel_Cell::stringFromColumnIndex($this->_startColumn));
96 
97  return $this;
98  }
seek($column='A')
Set the column pointer to the selected column.
adjustForExistingOnlyRange()
Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary.
static columnIndexFromString($pString='A')
Column index from string.
Definition: Cell.php:782
static stringFromColumnIndex($pColumnIndex=0)
String from columnindex.
Definition: Cell.php:825
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rewind()

PHPExcel_Worksheet_RowCellIterator::rewind ( )

Rewind the iterator to the starting column.

Definition at line 137 of file RowCellIterator.php.

References $_startColumn.

137  {
138  $this->_position = $this->_startColumn;
139  }

◆ seek()

PHPExcel_Worksheet_RowCellIterator::seek (   $column = 'A')

Set the column pointer to the selected column.

Parameters
string$columnThe column address to set the current pointer at
Returns
PHPExcel_Worksheet_RowCellIterator
Exceptions
PHPExcel_Exception

Definition at line 122 of file RowCellIterator.php.

References $column, and PHPExcel_Cell\columnIndexFromString().

Referenced by resetStart().

122  {
124  if (($column < $this->_startColumn) || ($column > $this->_endColumn)) {
125  throw new PHPExcel_Exception("Column $column is out of range ({$this->_startColumn} - {$this->_endColumn})");
126  } elseif ($this->_onlyExistingCells && !($this->_subject->cellExistsByColumnAndRow($column, $this->_rowIndex))) {
127  throw new PHPExcel_Exception('In "IterateOnlyExistingCells" mode and Cell does not exist');
128  }
129  $this->_position = $column;
130 
131  return $this;
132  }
$column
Definition: 39dropdown.php:62
static columnIndexFromString($pString='A')
Column index from string.
Definition: Cell.php:782
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ valid()

PHPExcel_Worksheet_RowCellIterator::valid ( )

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

Returns
boolean

Definition at line 196 of file RowCellIterator.php.

References $_endColumn.

196  {
197  return $this->_position <= $this->_endColumn;
198  }

Field Documentation

◆ $_endColumn

PHPExcel_Worksheet_RowCellIterator::$_endColumn = 0
protected

Definition at line 59 of file RowCellIterator.php.

Referenced by adjustForExistingOnlyRange(), and valid().

◆ $_rowIndex

PHPExcel_Worksheet_RowCellIterator::$_rowIndex
protected

Definition at line 45 of file RowCellIterator.php.

◆ $_startColumn

PHPExcel_Worksheet_RowCellIterator::$_startColumn = 0
protected

Definition at line 52 of file RowCellIterator.php.

Referenced by adjustForExistingOnlyRange(), and rewind().


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