Feature: Additional row iterator options: allow a start row to be defined in the constructor; seek(), and prev() methods added.
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@84512 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
b235c531a7
commit
24bd9b5e8a
|
@ -51,14 +51,24 @@ class PHPExcel_Worksheet_RowIterator extends CachingIterator
|
|||
*/
|
||||
private $_position = 1;
|
||||
|
||||
/**
|
||||
* Start position
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_startRow = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new row iterator
|
||||
*
|
||||
* @param PHPExcel_Worksheet $subject
|
||||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $subject = null) {
|
||||
public function __construct(PHPExcel_Worksheet $subject = null, $startRow = 1) {
|
||||
// Set subject
|
||||
$this->_subject = $subject;
|
||||
$this->resetStart($startRow);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,14 +79,33 @@ class PHPExcel_Worksheet_RowIterator extends CachingIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* Rewind iterator
|
||||
* (Re)Set the start row and the current row pointer
|
||||
*
|
||||
* @param integer $startRow The row number at which to start iterating
|
||||
*/
|
||||
public function rewind() {
|
||||
$this->_position = 1;
|
||||
public function resetStart($startRow = 1) {
|
||||
$this->_startRow = $startRow;
|
||||
$this->seek($startRow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Current PHPExcel_Worksheet_Row
|
||||
* Set the row pointer to the selected row
|
||||
*
|
||||
* @param integer $row The row number to set the current pointer at
|
||||
*/
|
||||
public function seek($row = 1) {
|
||||
$this->_position = $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewind the iterator to the starting row
|
||||
*/
|
||||
public function rewind() {
|
||||
$this->_position = $this->_startRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current row in this worksheet
|
||||
*
|
||||
* @return PHPExcel_Worksheet_Row
|
||||
*/
|
||||
|
@ -85,7 +114,7 @@ class PHPExcel_Worksheet_RowIterator extends CachingIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* Current key
|
||||
* Return the current iterator key
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@ -94,14 +123,22 @@ class PHPExcel_Worksheet_RowIterator extends CachingIterator
|
|||
}
|
||||
|
||||
/**
|
||||
* Next value
|
||||
* Set the iterator to its next value
|
||||
*/
|
||||
public function next() {
|
||||
++$this->_position;
|
||||
}
|
||||
|
||||
/**
|
||||
* More PHPExcel_Worksheet_Row instances available?
|
||||
* Set the iterator to its previous value
|
||||
*/
|
||||
public function prev() {
|
||||
if ($this->_position > 1)
|
||||
--$this->_position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate if more rows exist in the worksheet
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
|
|
|
@ -321,6 +321,7 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter
|
|||
foreach ($this->_phpExcel->getAllSheets() as $sheet) {
|
||||
if (count($sheet->getDrawingCollection()) > 0) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
Fixed in SVN:
|
||||
- Feature: (MBaker) Options for cell caching using Igbinary and SQLite/SQlite3.
|
||||
- Feature: (MBaker) Additional row iterator options: allow a start row to be defined in the constructor; seek(), and prev() methods added.
|
||||
- General: (MBaker) Fix to build to ensure that Examples are included with the documentation
|
||||
- General: (MBaker) Reduce cell caching overhead using dirty flag to ensure that cells are only rewritten to the cache if they have actually been changed
|
||||
- General: (MBaker) Improved memory usage in CSV Writer
|
||||
|
|
Loading…
Reference in New Issue