$table
$paramsTable
require_once 'classes/CreateDocx.inc';
$docx = new CreateDocx();
$valuesTable = array(
array(
11,
12
),
array(
21,
22
),
);
$paramsTable = array(
'border' => 'single',
'border_sz' => 20
);
$docx->addTable($valuesTable, $paramsTable);
$docx->createDocx('example_table');

require_once 'classes/CreateDocx.inc';
$docx = new CreateDocx();
$paramsLink = array(
'title' => 'Link to Google',
'link' => 'http://www.google.es'
);
$link = $docx->addElement('addLink', $paramsLink);
$paramsImg = array(
'name' => '../files/img/image.png'
);
$image = $docx->addElement('addImage', $paramsImg);
$valuesTable = array(
array(
'Title A',
'Title B',
'Title C',
),
array(
'Line A',
$link,
$image,
)
);
$paramsTable = array(
'TBLLOOKval' => 'ffff01E0',
'TBLSTYLEval' => 'Tablanormal',
'TBLWtype' => 'center',
'TBLWw' => '50',
'border' => 'single',
'border_sz' => 20,
'border_spacing' => 0,
'border_color' => 'ff0000',
'jc' => 'center',
'size_col' => 1200
);
$docx->addTable($valuesTable, $paramsTable);
$docx->createDocx('example_table');
7 Responses
Is it possible to merge table cells?
[...] are two new functions for tables and templates: fAddTable and [...]
How can I create my own table style, or specifically how do I shade the cells in my first row (the column headers) to blue?
Currently using PHPDocX 2.3, is it possible to merge cells?
size_col parameter, how does this work?
Is it possible to set the column with of each column in a table?
Is there a way to define a background color for a cell?
Ok found the background color parameter name (’cell_color’). Now I am looking vor a way to set the vertical allignment for a row to center. Any suggestions?