Documentation

AutoFilter
in package
implements Stringable

Table of Contents

Interfaces

Stringable

Methods

__clone()  : mixed
Implement PHP __clone to create a deep clone, not just a shallow copy.
__construct()  : mixed
Create a new AutoFilter.
__destruct()  : mixed
__toString()  : string
toString method replicates previous behavior by returning the range if object is referenced as a property of its parent.
autoExtendRange()  : int
Magic Range Auto-sizing.
clearColumn()  : $this
Clear a specified AutoFilter Column.
getColumn()  : Column
Get a specified AutoFilter Column.
getColumnByOffset()  : Column
Get a specified AutoFilter Column by it's offset.
getColumnOffset()  : int
Get a specified AutoFilter Column Offset within the defined AutoFilter range.
getColumns()  : array<string|int, Column>
Get all AutoFilter Columns.
getEvaluated()  : bool
getParent()  : null|Worksheet
Get AutoFilter Parent Worksheet.
getRange()  : string
Get AutoFilter Range.
setColumn()  : $this
Set AutoFilter.
setEvaluated()  : void
setParent()  : $this
Set AutoFilter Parent Worksheet.
setRange()  : self
Set AutoFilter Cell Range.
setRangeToMaxRow()  : self
shiftColumn()  : $this
Shift an AutoFilter Column Rule to a different column.
showHideRows()  : $this
Apply the AutoFilter rules to the AutoFilter Range.
testColumnInRange()  : int
Validate that the specified column is in the AutoFilter range.
filterTestInCustomDataSet()  : bool
Test if cell value is within a set of values defined by a ruleset.
filterTestInDateGroupSet()  : bool
Test if cell value is in the defined set of Excel date values.
filterTestInPeriodDateSet()  : bool
Test if cell date value is matches a set of values defined by a set of months.
filterTestInSimpleDataSet()  : bool
Test if cell value is in the defined set of values.

Methods

__clone()

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

public __clone() : mixed

__construct()

Create a new AutoFilter.

public __construct([AddressRange<string|int, CellAddress>|AddressRange<string|int, int>|AddressRange<string|int, string>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range = '' ][, Worksheet|null $worksheet = null ]) : mixed
Parameters
$range : AddressRange<string|int, CellAddress>|AddressRange<string|int, int>|AddressRange<string|int, string>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string = ''

A simple string containing a Cell range like 'A1:E10' is permitted or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), or an AddressRange object.

$worksheet : Worksheet|null = null

__toString()

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

public __toString() : string
Return values
string

autoExtendRange()

Magic Range Auto-sizing.

public autoExtendRange(int $startRow, int $endRow) : int

For a single row rangeSet, we follow MS Excel rules, and search for the first empty row to determine our range.

Parameters
$startRow : int
$endRow : int
Return values
int

clearColumn()

Clear a specified AutoFilter Column.

public clearColumn(string $column) : $this
Parameters
$column : string

Column name (e.g. A)

Return values
$this

getColumn()

Get a specified AutoFilter Column.

public getColumn(string $column) : Column
Parameters
$column : string

Column name (e.g. A)

Return values
Column

getColumnByOffset()

Get a specified AutoFilter Column by it's offset.

public getColumnByOffset(int $columnOffset) : Column
Parameters
$columnOffset : int

Column offset within range (starting from 0)

Return values
Column

getColumnOffset()

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

public getColumnOffset(string $column) : int
Parameters
$column : string

Column name (e.g. A)

Return values
int

The offset of the specified column within the autofilter range

getColumns()

Get all AutoFilter Columns.

public getColumns() : array<string|int, Column>
Return values
array<string|int, Column>

getEvaluated()

public getEvaluated() : bool
Return values
bool

getRange()

Get AutoFilter Range.

public getRange() : string
Return values
string

setColumn()

Set AutoFilter.

public setColumn(Column|string $columnObjectOrString) : $this
Parameters
$columnObjectOrString : Column|string

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

Return values
$this

setEvaluated()

public setEvaluated(bool $value) : void
Parameters
$value : bool

setParent()

Set AutoFilter Parent Worksheet.

public setParent([Worksheet|null $worksheet = null ]) : $this
Parameters
$worksheet : Worksheet|null = null
Return values
$this

setRange()

Set AutoFilter Cell Range.

public setRange([AddressRange<string|int, CellRange>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range = '' ]) : self
Parameters
$range : AddressRange<string|int, CellRange>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string = ''

A simple string containing a Cell range like 'A1:E10' or a Cell address like 'A1' is permitted or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), or an AddressRange object.

Return values
self

setRangeToMaxRow()

public setRangeToMaxRow() : self
Return values
self

shiftColumn()

Shift an AutoFilter Column Rule to a different column.

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

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
$fromColumn : string

Column name (e.g. A)

$toColumn : string

Column name (e.g. B)

Return values
$this

showHideRows()

Apply the AutoFilter rules to the AutoFilter Range.

public showHideRows() : $this
Return values
$this

testColumnInRange()

Validate that the specified column is in the AutoFilter range.

public testColumnInRange(string $column) : int
Parameters
$column : string

Column name (e.g. A)

Return values
int

The column offset within the autofilter range

filterTestInCustomDataSet()

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

protected static filterTestInCustomDataSet(mixed $cellValue, array<string|int, array<string|int, mixed>> $ruleSet) : bool
Parameters
$cellValue : mixed
$ruleSet : array<string|int, array<string|int, mixed>>
Return values
bool

filterTestInDateGroupSet()

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

protected static filterTestInDateGroupSet(mixed $cellValue, array{blanks: bool, filterValues: array>} $dataSet) : bool
Parameters
$cellValue : mixed
$dataSet : array{blanks: bool, filterValues: array>}
Return values
bool

filterTestInPeriodDateSet()

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

protected static filterTestInPeriodDateSet(mixed $cellValue, array<string|int, mixed> $monthSet) : bool
Parameters
$cellValue : mixed
$monthSet : array<string|int, mixed>
Return values
bool

filterTestInSimpleDataSet()

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

protected static filterTestInSimpleDataSet(mixed $cellValue, array{blanks: bool, filterValues: array>} $dataSet) : bool
Parameters
$cellValue : mixed
$dataSet : array{blanks: bool, filterValues: array>}
Return values
bool

        
On this page

Search results