Documentation

Table

Table of Contents

$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  : null|Worksheet
Table Worksheet.
__clone()  : mixed
Implement PHP __clone to create a deep clone, not just a shallow copy.
__construct()  : mixed
Create a new Table.
__toString()  : mixed
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.
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.
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.

Properties

$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
Return values
mixed

__construct()

Create a new Table.

public __construct([AddressRange|array<string|int, int>|string $range = '' ][, string $name = '' ]) : mixed
Parameters
$range : AddressRange|array<string|int, 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)

Return values
mixed

__toString()

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

public __toString() : mixed
Return values
mixed

clearColumn()

Clear a specified Table Column.

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

Column name (e.g. A)

Return values
self

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

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
Return values
self

setRange()

Set Table Cell Range.

public setRange([AddressRange|array<string|int, int>|string $range = '' ]) : self
Parameters
$range : AddressRange|array<string|int, 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

Search results