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
__destruct()
public
__destruct() : mixed
__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
stringautoExtendRange()
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
intclearColumn()
Clear a specified AutoFilter Column.
public
clearColumn(string $column) : $this
Parameters
- $column : string
-
Column name (e.g. A)
Return values
$thisgetColumn()
Get a specified AutoFilter Column.
public
getColumn(string $column) : Column
Parameters
- $column : string
-
Column name (e.g. A)
Return values
ColumngetColumnByOffset()
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
ColumngetColumnOffset()
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
boolgetParent()
Get AutoFilter Parent Worksheet.
public
getParent() : null|Worksheet
Return values
null|WorksheetgetRange()
Get AutoFilter Range.
public
getRange() : string
Return values
stringsetColumn()
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
$thissetEvaluated()
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
$thissetRange()
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
selfsetRangeToMaxRow()
public
setRangeToMaxRow() : self
Return values
selfshiftColumn()
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
$thisshowHideRows()
Apply the AutoFilter rules to the AutoFilter Range.
public
showHideRows() : $this
Return values
$thistestColumnInRange()
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
boolfilterTestInDateGroupSet()
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
boolfilterTestInPeriodDateSet()
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
boolfilterTestInSimpleDataSet()
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
>}