Quantcast
Channel: PHPExcel Forum Rss Feed
Viewing all articles
Browse latest Browse all 2707

New Post: Filter on calculated field

$
0
0
I'd like to apply a filter to a worksheet to grab only the rows where the value of a calculated field (a field calculated from values from fields in other worksheets in the same file) is greater than zero. Is this possible? This is the code I've tried but it doesn't filter anything and all of the calculated fields in the exported file are blank.
$objPHPExcel->getActiveSheet()->setAutoFilter($objPHPExcel->getActiveSheet()->calculateWorksheetDimension());
$autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter();
$autoFilter->getColumn($whichColumn)
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN, 0);
$autoFilter->showHideRows();
TIA,
Chris.

Viewing all articles
Browse latest Browse all 2707

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>