Hello,
By default all tables extend to fit the full width of the page.
You can overwrite this behaviour using a table style or the tableWidth option:
<?php
require_once 'classes/CreateDocx.inc';
$docx = new CreateDocx();
$valuesTable = array(
array(
11,
12,
),
array(
21,
22,
),
array(
31,
32,
),
);
$tableProperties = array(
'border' => 'single',
'borderColor' => '#000000',
'borderWidth' => 10,
'tableAlign' => 'center',
'tableLayout'=>'fixed',
'textProperties' => array('fontSize' => 11, 'textAlign' => 'center'),
'columnWidths' => array(2000, 2000),
'tableWidth' => array('type' => 'dxa', 'value' => 4000),
);
$docx->addTable($valuesTable, $tableProperties);
$docx->createDocx('output');
For further information about the tableWidth option please check this API doc:
http://www.phpdocx.com/api-documentation/word-content/add-table-Word-document-with-PHP
Regards.