Replies: 1   Views: 2901
Width in table
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by General research Computer Center  · 25-09-2016 - 16:57

How to set the width of columns?
tableData:width OR tableProperties: columnWidths?

If I have a simple table that works: columnWidths

But my table have WordFragment then  columnWidths not working

Posted by admin  · 26-09-2016 - 14:07


This sample uses columnWidths and WordFragments (it's included within all packages as example):


require_once 'classes/';

$docx = new CreateDocx();

// create a few Word fragments to insert rich content in a table

$link = new WordFragment($docx);
$options = array(
    'url' => ''

$link->addLink('Link to Google', $options);

$image = new WordFragment($docx);
$options = array(
    'src' => '../../img/image.png'


$valuesTable = array(
        'Title A',
        'Title B',
        'Title C'
        'Line A',

$paramsTable = array(
    'tableStyle' => 'LightListAccent1PHPDOCX',
    'tableAlign' => 'center',
    'columnWidths' => array(1000, 2500, 3000),

$docx->addTable($valuesTable, $paramsTable);