is there a more efficient way to delete rows in a loop than this workaround?
/**
* Delete all rows that are identified on the 'D'
* column with a $tag String value
* @param String $tag
*/
protected function deleteRowsByTag( $tag )
{
$found = true;
while( $found )
{
$found = false;
foreach ( $this->objWorksheet->getRowIterator() as $row )
{
$cell = $this->objWorksheet->getCell( "D" . $row->getRowIndex() );
$tag = str_replace( "tag_delete_", "", $tag );
if ( strtolower( trim( $cell->getValue() ) ) === $tag )
{
$delete_row = $row->getRowIndex();
// $this->objWorksheet->getRowIterator()->seek( $delete_row-2 );
$this->objWorksheet->removeRow( $delete_row );
$found = true;
break;
}
}
}
} // deleteRowByTag
I tried setting the row iterator to a prev->prev position but this did not do the trick (one of my attempts is commented in the code)
Thanks
PS: @Mark Baker - I am sorry, I did not read the manual too extensively :)