Forum


Replies: 2   Views: 3342
Paragraph styles ignored within a 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 AndrewCooper  · 10-06-2016 - 11:12

I've got the following code...

$item1 = new WordFragment($docx);
$item1->addText('Chapter 1', array('pStyle' => 'Heading1PHPDOCX'));
$item2 = new WordFragment($docx);
$item2->addText('Section', array('pStyle' => 'Heading2PHPDOCX'));
$item3 = new WordFragment($docx);
$item3->addText('Another TOC entry', array('pStyle' => 'Heading3PHPDOCX'));

$itemList= array(
    $item1,
    array(
        $item2,
        array($item3)
    )
);

$docx->addList($itemList);

While this adds the correct text to the List, it ignores the pStyle.  It just gets created in the default font and style.  How do I get the List to preserve the pStyle?  I need those items to be in Heading 1, Heading 2, etc.

Andrew