Replies: 12   Views: 3724
Custom list style issues
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 admin  · 12-09-2017 - 15:50


The left option is working fine, you can test it running this simple sample:


require_once 'classes/';

$docx = new CreateDocx();
// custom options
$latinListOptions = array();
$latinListOptions[0]['type'] = 'lowerLetter';
$latinListOptions[0]['format'] = '%1.';
$latinListOptions[0]['left'] = 1;
$latinListOptions[1]['type'] = 'lowerRoman';
$latinListOptions[1]['format'] = '%1.%2.';

// create the list style with name: latin
$docx->createListStyle('latin', $latinListOptions);

// list items
$myList = array('item 1', array('subitem 1.1', 'subitem 1.2'), 'item 2');

// insert custom list into the Word document
$docx->addList($myList, 'latin');

// save the Word document

But it seems the problem is that you are not setting the list style to the list of the HTML. The customListStyles option doesn't assign a style ID to a list, you need to use the wordStyles option. there're some samples of this property on this page:

Or you can use DOCXCustomizer to change the style ID of a list:

Or use the addList method instead of HTML if you want to have more control:

About inline and block types we just explaining that could be useful for some replacements, not your exact case.