Implement autofilter expressions #5
Comments
I think... First step, integration in PHPExcel core... and after Excel2007 for @MarkBaker & Excel5 for me... What do you think about that ? |
Basic rules for autofilters: The other major element of autofilters is sorting. It appears that autoFilter sorting actually change the content of the rows, so I'd recommend that we don't implement this.
My inclination is to replace the worksheet's autoFilter attribute (defining the range) with an PHPExcel_AutoFilter object comprising a range attribute and an array of PHPExcel_AutoFilter_Column objects, the PHPExcel_AutoFilter_Column objects comprising the array of rules (and the operator constants). |
It should be fairly easy to create the appropriate autofiltering classes, and to modify the Excel2007 Reader and Writer to handle this... the biggest problems I see are providing the appropriate methods to add/remove/modify the filter criteria, validating the filtering rules and then resetting all the row hidden attributes as appropriate. |
preparation for adding support for autofilter expressions
Note - Can't find any autofiltering in the Excel5 Reader other than in the sheet protection record, looks like it isn't implemented in the reader |
The refactoring committed for core 15 minutes ago should be completely transparent to any existing user code that accesses the autofilter range for backward compatibility |
@MarkBaker, I see your branche "autofilter"... I open a bug for "autofiltering in the Excel5 Reader". I will work on this when i have some time. What does it lack ? Expressions filters ? |
The changes committed to the autofilter branch so far simply replicate existing functionality... except using an autofilter class instead of a simple string. Using it should be absolutely identical to the existing 1.7.7 code (for backward compatibility). I'm now working on the additions to that class for the actual expression filters, but haven't committed any of that to the branch yet |
OK, so not quite as straightforward as I'd hoped - there's a couple of more complex types for date selections that I still need to make allowance for, but I've got the guts of reading, manipulating and writing now complete. Still need to do some fine tuning; and then I'll need to manage the data testing and hiding/unhiding or rows. |
That's all my code for AutoFilter expressions (core, for Excel2007 Reader and Excel2007 Writer) merged into the develop branch. This provides support for simple/standard filters, dategroup filters, custom filters, dynamic filters and top10 filters. It does not support colorFilters (the Rich Text rules are a real PITA), iconFilters or external filter lists - though I suspect these are all relatively rare anyway). Documentation is included, with a new AutoFilter Reference document. The only thing still outstanding is handling the actual hide/unhide of rows appropriate to the actual filter rules. That will take a little more work to implement.... as a nice bonus though, a lot of the filtering code should be relevant when I finally start to implement pivot tables. |
Autofilter Expressions implemented in core, and for Excel2007 Reader and Writer in Production release 1.7.8 |
As discussed with @MarkBaker on Twitter, I think it's interesting to implement in PHPExcel autofilter expressions.
If expressions are defined, autofilter is enabled, and some rows are hidden.
Twitter :
The text was updated successfully, but these errors were encountered: