"Fossies" - the Fresh Open Source Software Archive

Member "groupoffice-6.4.215-php-71/vendor/phpoffice/phpexcel/Documentation/markdown/Features/Autofilters/04-02-Autofilter-Expressions-Dategroup.md" (22 Nov 2018, 1607 Bytes) of package /linux/www/groupoffice-6.4.215-php-71.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

PHPExcel AutoFilter Reference

Autofilter Expressions

DateGroup Filters

In MS Excel, DateGroup filters provide a series of dropdown filter selectors for date values, so you can specify entire years, or months within a year, or individual days within each month.

04-02-dategroup-autofilter.png

DateGroup filters are still applied as a Standard Filter type.

$columnFilter->setFilterType(
    PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER
);

Creating a dateGroup filter in PHPExcel, you specify the values for “checked” columns as an associative array of year. month, day, hour minute and second. To select a year and month, you need to create a DateGroup rule identifying the selected year and month:

$columnFilter->createRule()
    ->setRule(
        PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
        array(
            'year' => 2012,
            'month' => 1
        )
    )
    ->setRuleType(
        PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP
    );

The key values for the associative array are:

Like Standard filters, DateGroup filters are always a match of EQUALS, and multiple standard filters are always treated as being joined by an OR condition.

Note that we alse specify a ruleType: to differentiate this from a standard filter, we explicitly set the Rule’s Type to AUTOFILTER_RULETYPE_DATEGROUP. As with standard filters, we can create any number of DateGroup Filters.