Excel table

An Excel table marks a rectangular region of a worksheet as a "smart table" with header row, autofilter, banded rows, total row and so on. The cells themselves stay normal cells; the table just adds a metadata file under xl/tables/tableN.xml.

There are two steps:

  1. Build the options with Vtiful\Kernel\Table.

  2. Apply them with Excel::addTable(string $rangeA1, ?Table $opts = null).

Note: Table does not use toResource(). Pass the Table instance directly as the second argument to addTable(). Omit the second argument to use libxlsxwriter's default table style.

Function prototype

\Vtiful\Kernel\Excel::addTable(string $rangeA1, ?\Vtiful\Kernel\Table $opts = null): self

string $rangeA1

The cell range covered by the table, in A1 notation, e.g. A1:D11. The range must include both the header row and at least one data row.

?Table $opts

Optional Table builder. When null, libxlsxwriter's defaults are used.

Sub-sections

Example

Last updated