diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index 64256dc..e3bcd06 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -2777,6 +2777,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable } elseif ($key == '_drawingCollection') { $newCollection = clone $this->_drawingCollection; $this->_drawingCollection = $newCollection; + } elseif (($key == '_autoFilter') && (is_a($this->_autoFilter,'PHPExcel_Worksheet_AutoFilter'))) { + $newAutoFilter = clone $this->_autoFilter; + $this->_autoFilter = $newAutoFilter; + $this->_autoFilter->setParent($this); } else { $this->{$key} = unserialize(serialize($val)); } diff --git a/Classes/PHPExcel/Worksheet/AutoFilter.php b/Classes/PHPExcel/Worksheet/AutoFilter.php index e84ff21..08f5df2 100644 --- a/Classes/PHPExcel/Worksheet/AutoFilter.php +++ b/Classes/PHPExcel/Worksheet/AutoFilter.php @@ -587,7 +587,7 @@ class PHPExcel_Worksheet_AutoFilter list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range); // The heading row should always be visible - echo 'AutoFilter Heading Row ',$rangeStart[1],' is always SHOWN',PHP_EOL; +// echo 'AutoFilter Heading Row ',$rangeStart[1],' is always SHOWN',PHP_EOL; $this->_workSheet->getRowDimension($rangeStart[1])->setVisible(TRUE); $columnFilterTests = array(); @@ -763,17 +763,17 @@ class PHPExcel_Worksheet_AutoFilter } } - echo 'Column Filter Test CRITERIA',PHP_EOL; - var_dump($columnFilterTests); - +// echo 'Column Filter Test CRITERIA',PHP_EOL; +// var_dump($columnFilterTests); +// // Execute the column tests for each row in the autoFilter range to determine show/hide, for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) { - echo 'Testing Row = ',$row,PHP_EOL; +// echo 'Testing Row = ',$row,PHP_EOL; $result = TRUE; foreach($columnFilterTests as $columnID => $columnFilterTest) { - echo 'Testing cell ',$columnID.$row,PHP_EOL; +// echo 'Testing cell ',$columnID.$row,PHP_EOL; $cellValue = $this->_workSheet->getCell($columnID.$row)->getCalculatedValue(); - echo 'Value is ',$cellValue,PHP_EOL; +// echo 'Value is ',$cellValue,PHP_EOL; // Execute the filter test $result = $result && call_user_func_array( @@ -783,13 +783,13 @@ class PHPExcel_Worksheet_AutoFilter $columnFilterTest['arguments'] ) ); - echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL; +// echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL; // If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests if (!$result) break; } // Set show/hide for the row based on the result of the autoFilter result - echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL; +// echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL; $this->_workSheet->getRowDimension($row)->setVisible($result); } @@ -815,7 +815,7 @@ class PHPExcel_Worksheet_AutoFilter $this->$key = array(); foreach ($value as $k => $v) { $this->$key[$k] = clone $v; - // attache the new cloned Column to this new cloned Autofilter object + // attach the new cloned Column to this new cloned Autofilter object $this->$key[$k]->setParent($this); } } else { diff --git a/Classes/PHPExcel/Worksheet/AutoFilter/Column.php b/Classes/PHPExcel/Worksheet/AutoFilter/Column.php index d7b866b..d41c3ed 100644 --- a/Classes/PHPExcel/Worksheet/AutoFilter/Column.php +++ b/Classes/PHPExcel/Worksheet/AutoFilter/Column.php @@ -369,6 +369,8 @@ class PHPExcel_Worksheet_AutoFilter_Column $this->$key = array(); foreach ($value as $k => $v) { $this->$key[$k] = clone $v; + // attach the new cloned Rule to this new cloned Autofilter Cloned object + $this->$key[$k]->setParent($this); } } else { $this->$key = $value;