class AutoFilter (View source)

Methods

__construct(string $pRange = '', Worksheet $pSheet = null)

Create a new AutoFilter.

getParent()

Get AutoFilter Parent Worksheet.

setParent(Worksheet $pSheet = null)

Set AutoFilter Parent Worksheet.

string
getRange()

Get AutoFilter Range.

setRange(string $pRange)

Set AutoFilter Range.

Column[]
getColumns()

Get all AutoFilter Columns.

int
testColumnInRange(string $column)

Validate that the specified column is in the AutoFilter range.

int
getColumnOffset(string $pColumn)

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

getColumn(string $pColumn)

Get a specified AutoFilter Column.

getColumnByOffset(int $pColumnOffset)

Get a specified AutoFilter Column by it's offset.

setColumn(Column|string $pColumn)

Set AutoFilter.

clearColumn(string $pColumn)

Clear a specified AutoFilter Column.

shiftColumn(string $fromColumn, string $toColumn)

Shift an AutoFilter Column Rule to a different column.

showHideRows()

Apply the AutoFilter rules to the AutoFilter Range.

__clone()

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

__toString()

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

Details

__construct(string $pRange = '', Worksheet $pSheet = null)

Create a new AutoFilter.

Parameters

string $pRange Cell range (i.e. A1:E10)
Worksheet $pSheet

Worksheet getParent()

Get AutoFilter Parent Worksheet.

Return Value

Worksheet

AutoFilter setParent(Worksheet $pSheet = null)

Set AutoFilter Parent Worksheet.

Parameters

Worksheet $pSheet

Return Value

AutoFilter

string getRange()

Get AutoFilter Range.

Return Value

string

AutoFilter setRange(string $pRange)

Set AutoFilter Range.

Parameters

string $pRange Cell range (i.e. A1:E10)

Return Value

AutoFilter

Exceptions

Exception

Column[] getColumns()

Get all AutoFilter Columns.

Return Value

Column[]

int testColumnInRange(string $column)

Validate that the specified column is in the AutoFilter range.

Parameters

string $column Column name (e.g. A)

Return Value

int The column offset within the autofilter range

Exceptions

Exception

int getColumnOffset(string $pColumn)

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

Parameters

string $pColumn Column name (e.g. A)

Return Value

int The offset of the specified column within the autofilter range

Exceptions

Exception

Column getColumn(string $pColumn)

Get a specified AutoFilter Column.

Parameters

string $pColumn Column name (e.g. A)

Return Value

Column

Exceptions

Exception

Column getColumnByOffset(int $pColumnOffset)

Get a specified AutoFilter Column by it's offset.

Parameters

int $pColumnOffset Column offset within range (starting from 0)

Return Value

Column

Exceptions

Exception

AutoFilter setColumn(Column|string $pColumn)

Set AutoFilter.

Parameters

Column|string $pColumn A simple string containing a Column ID like 'A' is permitted

Return Value

AutoFilter

Exceptions

Exception

AutoFilter clearColumn(string $pColumn)

Clear a specified AutoFilter Column.

Parameters

string $pColumn Column name (e.g. A)

Return Value

AutoFilter

Exceptions

Exception

AutoFilter shiftColumn(string $fromColumn, string $toColumn)

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)

Return Value

AutoFilter

AutoFilter showHideRows()

Apply the AutoFilter rules to the AutoFilter Range.

Return Value

AutoFilter

Exceptions

Exception

__clone()

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

__toString()

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