TABLES
Table of Contents
Functions
- tables() : mixed
- Set and get and manipulate table settings and elements.
- tableHeaders() : bool
- Handle table headers to be written to the XML after all tables' data have been collected.
- getGridArray() : array<string|int, mixed>
- Get the gridArray for the table cells once they have all been parsed and the table properties are ready to be finalised in XML.
- calculateGridArrayWidths() : array<string|int, mixed>
- Calculate the gridArray widths.
- startTable() : void
- Start a new table
- endTable() : void
- End a table
- writeCells() : bool
- Write the table cell widths (for existing cells) and insert vMerge=continue cells after having created the grid.
- createVmergeCell() : DOMNode
- Write a vMerge=continue cell.
- writeTblGrid() : void
- Write the tblGrid node
- createTblProps() : void
- Set up the tblPr node
- startRow() : void
- Start a new table row
- endRow() : void
- End a table row
- startCell() : void
- Start a new table cell
- vMergeProps() : mixed
- Set and get and reset the properties of the vMerge=restart cells for use in their vMerge=continue cells
- cellProps() : array<string|int, mixed>
- Do properties (borders, shading) for table cells
- endCell() : void
- End a table cell
Functions
tables()
Set and get and manipulate table settings and elements.
tables(string $method[, XMLWriter $xml = NULL ][, string $param = '' ][, array<string|int, mixed> $attr = [] ]) : mixed
Parameters
- $method : string
- $xml : XMLWriter = NULL
-
Default NULL
- $param : string = ''
-
Default ''
- $attr : array<string|int, mixed> = []
-
Default []
tableHeaders()
Handle table headers to be written to the XML after all tables' data have been collected.
tableHeaders(string $method[, string $input = '' ][, array<string|int, mixed> $attr = [] ]) : bool
TinyMCE is quite buggy. Cell splitting or merging in the editor can leave behind empty rows or cells and lead to incorrect colspan or rowspan values. Additionally, nesting tables in tinyMCE is problematic. For example, I have seen situations where not only is the width of a table set to more than 100% but that width is for a table nested within another table that has a width of less than 100%. Sometimes, two widths are given for the table . . .
Parameters
- $method : string
- $input : string = ''
-
Default ''
- $attr : array<string|int, mixed> = []
-
Default []
Return values
boolgetGridArray()
Get the gridArray for the table cells once they have all been parsed and the table properties are ready to be finalised in XML.
getGridArray(array<string|int, mixed> $header) : array<string|int, mixed>
Parameters
- $header : array<string|int, mixed>
Return values
array<string|int, mixed>calculateGridArrayWidths()
Calculate the gridArray widths.
calculateGridArrayWidths(array<string|int, mixed> $header) : array<string|int, mixed>
Parameters
- $header : array<string|int, mixed>
Return values
array<string|int, mixed>startTable()
Start a new table
startTable(XMLWriter $xml, array<string|int, mixed> $attr) : void
Parameters
- $xml : XMLWriter
- $attr : array<string|int, mixed>
endTable()
End a table
endTable(XMLWriter $xml) : void
Parameters
- $xml : XMLWriter
writeCells()
Write the table cell widths (for existing cells) and insert vMerge=continue cells after having created the grid.
writeCells(DOMDocument $dom, DOMNode $table, array<string|int, mixed> $header) : bool
Note, that with nested tables, the list of cells gathered with getElementsByTagName('tc') is from both the mother table and the nested table.
Parameters
- $dom : DOMDocument
- $table : DOMNode
- $header : array<string|int, mixed>
Return values
boolcreateVmergeCell()
Write a vMerge=continue cell.
createVmergeCell(DOMDocument $dom, array<string|int, mixed> $header, string $vmCellId) : DOMNode
Parameters
- $dom : DOMDocument
- $header : array<string|int, mixed>
- $vmCellId : string
Return values
DOMNodewriteTblGrid()
Write the tblGrid node
writeTblGrid(DOMDocument $dom, DOMNode $table, array<string|int, mixed> $gridArray) : void
Parameters
- $dom : DOMDocument
- $table : DOMNode
- $gridArray : array<string|int, mixed>
createTblProps()
Set up the tblPr node
createTblProps(DOMDocument $dom, DOMNode $table, array<string|int, mixed> $gridArray, array<string|int, mixed> $attr) : void
Parameters
- $dom : DOMDocument
- $table : DOMNode
- $gridArray : array<string|int, mixed>
- $attr : array<string|int, mixed>
startRow()
Start a new table row
startRow(XMLWriter $xml, array<string|int, mixed> $attr) : void
The border exceptions are not working. See http://officeopenxml.com/WPtablePropertyExceptions.php
Parameters
- $xml : XMLWriter
- $attr : array<string|int, mixed>
endRow()
End a table row
endRow(XMLWriter $xml) : void
Parameters
- $xml : XMLWriter
startCell()
Start a new table cell
startCell(XMLWriter $xml, array<string|int, mixed> $attr) : void
Note that tinyMce typically provides individual cell widths that, in any row, add up to less than the specified table width. The specified table width is used for calculations but, at the end when the XML is written for the table properties, the value for w:tblW is adjusted from that stored in the table header array to be a sum of the cell widths in the first row.
Parameters
- $xml : XMLWriter
- $attr : array<string|int, mixed>
vMergeProps()
Set and get and reset the properties of the vMerge=restart cells for use in their vMerge=continue cells
vMergeProps(string $method[, string $cellId = '' ][, array<string|int, mixed> $props = [] ]) : mixed
Parameters
- $method : string
- $cellId : string = ''
-
Default is ''
- $props : array<string|int, mixed> = []
-
Default is []
cellProps()
Do properties (borders, shading) for table cells
cellProps(XMLWriter $xml, array<string|int, mixed> $attr) : array<string|int, mixed>
Parameters
- $xml : XMLWriter
- $attr : array<string|int, mixed>
Return values
array<string|int, mixed>endCell()
End a table cell
endCell(XMLWriter $xml) : void
Parameters
- $xml : XMLWriter