Hello,
We are not sure if we understand your question correctly. If you just need to create tables from an array you can just any loop function: for, while, foreach... ; phpdocx allows using any data source (databases, web services, strings, CSV...)
In the package you can find samples about how to generate a new table, for example:
// get the data for the database using PDO functions, an ORM or any other code
$data = ...;
// iterate the previous data to generate and add each new table
$i = 0;
while ($i < count($data)) {
$valuesTable = $data[$i]; // an array structure
$paramsTable = array(
'border' => 'single',
'tableAlign' => 'center',
'borderWidth' => 10,
'borderColor' => 'B70000',
'tableWidth' => array('type' =>'pct', 'value' => 0),
); // add the needed table properties
$docx->addTable($valuesTable, $paramsTable);
$i++;
}
We recommend you to check and run the included samples and the documentation available on addTable.
Regards.