Properties

$workSheet

$workSheet : \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

Autofilter Worksheet.

Type

Worksheet

$range

$range : string

Autofilter Range.

Type

string

$columns

$columns : \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column[]

Autofilter Column Ruleset.

Type

Column[]

$fromReplace

$fromReplace : array

Search/Replace arrays to convert Excel wildcard syntax to a regexp syntax for preg_matching.

Type

array

$toReplace

$toReplace

Methods

__construct()

__construct(string  $pRange = '', \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet  $pSheet = null) : mixed

Create a new AutoFilter.

Parameters

string $pRange

Cell range (i.e. A1:E10)

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pSheet

Returns

mixed —

getParent()

getParent() : \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

Get AutoFilter Parent Worksheet.

Returns

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet —

setParent()

setParent(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet  $pSheet = null) : $this

Set AutoFilter Parent Worksheet.

Parameters

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pSheet

Returns

$this —

getRange()

getRange() : string

Get AutoFilter Range.

Returns

string —

setRange()

setRange(string  $pRange) : $this

Set AutoFilter Range.

Parameters

string $pRange

Cell range (i.e. A1:E10)

Returns

$this —

getColumns()

getColumns() : \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column[]

Get all AutoFilter Columns.

Returns

\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column[] —

testColumnInRange()

testColumnInRange(string  $column) : int

Validate that the specified column is in the AutoFilter range.

Parameters

string $column

Column name (e.g. A)

Returns

int —

The column offset within the autofilter range

getColumnOffset()

getColumnOffset(string  $pColumn) : int

Get a specified AutoFilter Column Offset within the defined AutoFilter range.

Parameters

string $pColumn

Column name (e.g. A)

Returns

int —

The offset of the specified column within the autofilter range

getColumn()

getColumn(string  $pColumn) : \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column

Get a specified AutoFilter Column.

Parameters

string $pColumn

Column name (e.g. A)

Returns

\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column —

getColumnByOffset()

getColumnByOffset(int  $pColumnOffset) : \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column

Get a specified AutoFilter Column by it's offset.

Parameters

int $pColumnOffset

Column offset within range (starting from 0)

Returns

\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column —

setColumn()

setColumn(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column|string  $pColumn) : $this

Set AutoFilter.

Parameters

\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column|string $pColumn

A simple string containing a Column ID like 'A' is permitted

Returns

$this —

clearColumn()

clearColumn(string  $pColumn) : $this

Clear a specified AutoFilter Column.

Parameters

string $pColumn

Column name (e.g. A)

Returns

$this —

shiftColumn()

shiftColumn(string  $fromColumn, string  $toColumn) : $this

Shift an AutoFilter Column Rule to a different column.

Note: This method bypasses validation of the destination column to ensure it is within this AutoFilter range. Nor does it verify whether any column rule already exists at $toColumn, but will simply override any existing value. Use with caution.

Parameters

string $fromColumn

Column name (e.g. A)

string $toColumn

Column name (e.g. B)

Returns

$this —

showHideRows()

showHideRows() : $this

Apply the AutoFilter rules to the AutoFilter Range.

Returns

$this —

__clone()

__clone() : mixed

Implement PHP __clone to create a deep clone, not just a shallow copy.

Returns

mixed —

__toString()

__toString() : mixed

toString method replicates previous behavior by returning the range if object is referenced as a property of its parent.

Returns

mixed —

filterTestInSimpleDataSet()

filterTestInSimpleDataSet(mixed  $cellValue, array  $dataSet) : bool

Test if cell value is in the defined set of values.

Parameters

mixed $cellValue
array $dataSet

Returns

bool —

filterTestInDateGroupSet()

filterTestInDateGroupSet(mixed  $cellValue, array  $dataSet) : bool

Test if cell value is in the defined set of Excel date values.

Parameters

mixed $cellValue
array $dataSet

Returns

bool —

filterTestInCustomDataSet()

filterTestInCustomDataSet(mixed  $cellValue, array  $ruleSet) : bool

Test if cell value is within a set of values defined by a ruleset.

Parameters

mixed $cellValue
array $ruleSet

Returns

bool —

filterTestInPeriodDateSet()

filterTestInPeriodDateSet(mixed  $cellValue, array  $monthSet) : bool

Test if cell date value is matches a set of values defined by a set of months.

Parameters

mixed $cellValue
array $monthSet

Returns

bool —

dynamicFilterDateRange()

dynamicFilterDateRange(string  $dynamicRuleType, \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column  $filterColumn) : array

Convert a dynamic rule daterange to a custom filter range expression for ease of calculation.

Parameters

string $dynamicRuleType
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column $filterColumn

Returns

array —

calculateTopTenValue()

calculateTopTenValue(mixed  $columnID, mixed  $startRow, mixed  $endRow, mixed  $ruleType, mixed  $ruleValue) : mixed

Parameters

mixed $columnID
mixed $startRow
mixed $endRow
mixed $ruleType
mixed $ruleValue

Returns

mixed —