addTable
addTable
BASIC / ADVANCED / PREMIUM
Adds tables into the PowerPoint presentation.
Description
public addTable($contents, $position, $tableStyles = array(), $rowStyles = array(), $options = array())
This method inserts tables into the PowerPoint presentation.
Parameters
contents
A multidimensional array of cell contents and styles. PptxFragments can be used to add contents.
Key | Type | Description |
---|---|---|
text | string|array | See addText for text styles. |
align | string | left, center, right, justify |
backgroundColor | string | HEX color |
border | array |
'top', 'right', 'bottom', 'left' keys can be used to set borders
|
cellMargin | array |
|
colspan | int | HEX color. |
rowspan | int | |
textDirection | string | horz, vert, vert270, wordArtVert, eaVert, mongolianVert, wordArtVertRtl. |
verticalAlign | string | top, middle, bottom, topCentered, middleCentered, bottomCentered. |
wrap | string | square, none. |
position
Key | Type | Description |
---|---|---|
new | array |
A new position is generated.
|
tableStyles
Key | Type | Description |
---|---|---|
backgroundColor | string | HEX color. |
bandedColumns | bool | Banded columns. Default as false. |
bandedRows | bool | Banded rows. Default as false. |
border | array |
|
cellMargin | array |
|
columnWidths | int|array | Column width fix (int) or column width variable (array). If not set, get from the shape size. EMUs (English Metric Unit). |
firstColumn | bool | First column. Default as false. |
headerRow | bool | Header row. Default as false. |
lastColumn | bool | Last column. Default as false. |
style | string | Table style name. Using a template, if the table doesn't exist, try to import it from the base template. |
totalRow | bool | Total row. Default as false. |
rowStyles
Array for each row.
Key | Type | Description |
---|---|---|
height | int | EMUs (English Metric Unit). |
Exceptions
Position not valid.
Table style doesn't exist.
Code samples
Release notes
- phppptx 1.0:
- new method.