Documentation

Table
in package
implements Stringable

Table of Contents

Interfaces

Stringable

Properties

$allowFilter  : bool
Table allow filter.
$autoFilter  : AutoFilter
Table AutoFilter.
$columns  : array<string|int, Column>
Table Column.
$name  : string
Table Name.
$range  : string
Table Range.
$showHeaderRow  : bool
Show Header Row.
$showTotalsRow  : bool
Show Totals Row.
$style  : TableStyle
Table Style.
$workSheet  : Worksheet|null
Table Worksheet.

Methods

__clone()  : mixed
Implement PHP __clone to create a deep clone, not just a shallow copy.
__construct()  : mixed
Create a new Table.
__destruct()  : mixed
Code to execute when this table is unset().
__toString()  : string
toString method replicates previous behavior by returning the range if object is referenced as a property of its worksheet.
clearColumn()  : self
Clear a specified Table Column.
getAllowFilter()  : bool
Get allow filter.
getAutoFilter()  : AutoFilter
Get AutoFilter.
getColumn()  : Column
Get a specified Table Column.
getColumnByOffset()  : Column
Get a specified Table Column by it's offset.
getColumnOffset()  : int
Get a specified Table Column Offset within the defined Table range.
getColumns()  : array<string|int, Column>
Get all Table Columns.
getName()  : string
Get Table name.
getRange()  : string
Get Table Range.
getShowHeaderRow()  : bool
Get show Header Row.
getShowTotalsRow()  : bool
Get show Totals Row.
getStyle()  : TableStyle
Get table Style.
getWorksheet()  : Worksheet|null
Get Table's Worksheet.
isColumnInRange()  : int
Validate that the specified column is in the Table range.
setAllowFilter()  : self
Set show Autofiltering.
setAutoFilter()  : self
Set AutoFilter.
setColumn()  : self
Set Table.
setName()  : self
Set Table name.
setRange()  : self
Set Table Cell Range.
setRangeToMaxRow()  : self
Set Table Cell Range to max row.
setShowHeaderRow()  : self
Set show Header Row.
setShowTotalsRow()  : self
Set show Totals Row.
setStyle()  : self
Set table Style.
setWorksheet()  : self
Set Table's Worksheet.
shiftColumn()  : self
Shift an Table Column Rule to a different column.
checkForDuplicateTableNames()  : void
updateStructuredReferences()  : void
updateStructuredReferencesInCells()  : void
updateStructuredReferencesInNamedFormulae()  : void

Properties

$allowFilter

Table allow filter.

private bool $allowFilter = true

$columns

Table Column.

private array<string|int, Column> $columns = []

$name

Table Name.

private string $name

$range

Table Range.

private string $range = ''

$showHeaderRow

Show Header Row.

private bool $showHeaderRow = true

$showTotalsRow

Show Totals Row.

private bool $showTotalsRow = false

Methods

__clone()

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

public __clone() : mixed

__construct()

Create a new Table.

public __construct([AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range = '' ][, string $name = '' ]) : mixed
Parameters
$range : AddressRange|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.

$name : string = ''

(e.g. Table1)

__destruct()

Code to execute when this table is unset().

public __destruct() : mixed

__toString()

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

public __toString() : string
Return values
string

clearColumn()

Clear a specified Table Column.

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

Column name (e.g. A)

Return values
self

getAllowFilter()

Get allow filter.

public getAllowFilter() : bool

If false, autofiltering is disabled for the table, if true it is enabled.

Return values
bool

getColumn()

Get a specified Table Column.

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

Column name (e.g. A)

Return values
Column

getColumnByOffset()

Get a specified Table 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 Table Column Offset within the defined Table 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 table range

getColumns()

Get all Table Columns.

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

getName()

Get Table name.

public getName() : string
Return values
string

getRange()

Get Table Range.

public getRange() : string
Return values
string

getShowHeaderRow()

Get show Header Row.

public getShowHeaderRow() : bool
Return values
bool

getShowTotalsRow()

Get show Totals Row.

public getShowTotalsRow() : bool
Return values
bool

isColumnInRange()

Validate that the specified column is in the Table range.

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

Column name (e.g. A)

Return values
int

The column offset within the table range

setAllowFilter()

Set show Autofiltering.

public setAllowFilter(bool $allowFilter) : self

Disabling autofiltering has the same effect as hiding the filter button on all the columns in the table.

Parameters
$allowFilter : bool
Return values
self

setAutoFilter()

Set AutoFilter.

public setAutoFilter(AutoFilter $autoFilter) : self
Parameters
$autoFilter : AutoFilter
Return values
self

setColumn()

Set Table.

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

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

Return values
self

setName()

Set Table name.

public setName(string $name) : self
Parameters
$name : string
Tags
throws
Exception
Return values
self

setRange()

Set Table Cell Range.

public setRange([AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range = '' ]) : self
Parameters
$range : AddressRange|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.

Return values
self

setRangeToMaxRow()

Set Table Cell Range to max row.

public setRangeToMaxRow() : self
Return values
self

setShowHeaderRow()

Set show Header Row.

public setShowHeaderRow(bool $showHeaderRow) : self
Parameters
$showHeaderRow : bool
Return values
self

setShowTotalsRow()

Set show Totals Row.

public setShowTotalsRow(bool $showTotalsRow) : self
Parameters
$showTotalsRow : bool
Return values
self

setWorksheet()

Set Table's Worksheet.

public setWorksheet([Worksheet|null $worksheet = null ]) : self
Parameters
$worksheet : Worksheet|null = null
Return values
self

shiftColumn()

Shift an Table Column Rule to a different column.

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

Note: This method bypasses validation of the destination column to ensure it is within this Table 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
self

checkForDuplicateTableNames()

private checkForDuplicateTableNames(string $name, Worksheet|null $worksheet) : void
Parameters
$name : string
$worksheet : Worksheet|null
Tags
throws
Exception

updateStructuredReferences()

private updateStructuredReferences(string $name) : void
Parameters
$name : string

updateStructuredReferencesInCells()

private updateStructuredReferencesInCells(Worksheet $worksheet, string $newName) : void
Parameters
$worksheet : Worksheet
$newName : string

updateStructuredReferencesInNamedFormulae()

private updateStructuredReferencesInNamedFormulae(Spreadsheet $spreadsheet, string $newName) : void
Parameters
$spreadsheet : Spreadsheet
$newName : string

        
On this page

Search results