Comments (10)
I think... First step, integration in PHPExcel core... and after Excel2007 for @MarkBaker & Excel5 for me...
What do you think about that ?
from phpexcel.
Basic rules for autofilters:
Each worksheet can only have a single autofilter... at a minimum defined as the cell range to which the autofilter options can be applied... this is what we do at the moment. In Excel2007, this is the ref attribute of the worksheets autoFilter element.
When filters are actually applied, then each column in the range can have one or more custom filters. These are identified by customFilter elements in filterColumn elements.Multiple filter criteria can be combined using AND or OR, and (depending on the datatype) they can include ? or * wildcards, and can have an operator such as greaterThanOrEqual.
If a filter is applied, then all rows in the range that match the criteria are visible, all other rows are hidden... matching this logic in PHPExcel adds a level of complexity when adding or changing filter criteria.
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.
<autoFilter ref="D1:E10">
<filterColumn colId="0">
<customFilters>
<customFilter val="A*"/>
<customFilter val="*E"/>
</customFilters>
</filterColumn>
<filterColumn colId="1">
<customFilters>
<customFilter val="2" operator="greaterThanOrEqual"/>
</customFilters>
</filterColumn>
</autoFilter>
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).
from phpexcel.
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.
from phpexcel.
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
from phpexcel.
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
from phpexcel.
@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 ?
from phpexcel.
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
from phpexcel.
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.
I'm also going to adjust the autoCalculate column width while I'm about it to allow for teh width of the autofilter dropdown icon... but on schedule still to have the basics for Excel2007 working by next weekend, and on target for a 1.7.8 release.
from phpexcel.
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.
from phpexcel.
Autofilter Expressions implemented in core, and for Excel2007 Reader and Writer in Production release 1.7.8
from phpexcel.
Related Issues (20)
- Is it possible to use php send excel files to client's printer?
- Php Excel fails at load
- Font Style existed but not visible
- exception 'directory'yii\base\ErrorException' with message 'ZipArchive::close(): Failure to create temporary file: No such file
- Syntax error
- An implementation cannot be declared in ambient contexts.
- Setting workbook password does not seem to work at all
- Can't export any excel
- "Excel cannot open the file 'filename.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file. HOT 2
- How can I open the encrypted file?
- Install pathing not working HOT 1
- Do you have a simplified version of PHPExcel?
- Double include PHPExcel_Cell::stringFromColumnIndex function
- PHPExcel_Worksheet_Drawing
- PHP Excel 1.8.2 Loss of precision when writing numeric strings
- Fatal error: Missing function on 1.8.2
- 发现内容部分有错误 HOT 1
- Set document properties with UTF-8 Encoding (for accents)
- read csv with long number data get scientific notation
- export Excel with formulas
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpexcel.