Forum


Replies: 6   Views: 3193
Custom list style in embedhtml
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  · 24-08-2017 - 13:38

Hello,

It works too using WordFragments, but you need to add the numbering style to the WordFragment:

$htmlWordFragment = new WordFragment($docx);

$listOptions = array();
$listOptions[0]['type'] = 'bullet';
$listOptions[0]['format'] = 'G';
$listOptions[0]['color'] = '0a46ba';
$listOptions[0]['font'] = 'Wingdings';
$listOptions[1]['type'] = 'bullet';
$listOptions[1]['color'] = '0a46ba';
$listOptions[1]['format'] = 'F';
$listOptions[1]['font'] = 'Wingdings';

$htmlWordFragment->createListStyle('bullet', $listOptions);

$html = 'a lot of html and a list <ul class="bullet"><li>example</li></ul> and a bit more html';

$htmlWordFragment->embedHTML($html, array('customListStyles' => true));

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


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

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

Regards.