Replies: 4   Views: 339
Tabs in list
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 IHD  · 10-12-2018 - 14:35


Is it not possible to set tabPositions when using addText method on a wordFragment which is then included as a list item? 

The following code should do it: 

$docx = new CreateDocx();

$textData = new WordFragment($docx);
$tabs = array();
$tabs[] = array('position' => 4000, 'leader' => 'dot');
$tabs[] = array('position' => 6000, 'leader' => 'dot');
$tabs[] = array('position' => 8000, 'leader' => 'dot');
$options = array('tabPositions' => $tabs);

$text = array();
$text[] = array('text' => 'one');
$text[] = array('text' => 'two', 'tab' => true);
$text[] = array('text' => 'three', 'tab' => true);

$textData->addText($text, $options);

$itemList= array(
    'In this example we use a custom list (val = 5) that comes bundled with the default PHPdocX template.',
        'Line B',
        'Line C'
    'Line 3',

// set the style type to 5: other predefined Word list style
$docx->addList($itemList, 5);


The tabs work fine if i run $docx->addText($text, $options);  and then just create the document, but it does not work as expected when running $textData->addText($text, $options); and then including $textData as a list item. 

Any idea/workaround?