Forum


Replies: 3   Views: 129
Parsestyles returns a php notice

Posted by admin  · 31-07-2019 - 06:24

Hello,

The method is returning a PHP notice, not an error. It seems you are using a Symfony configuration that returns an Exception when a notice is found.

You can hide the notice using this line:

@$docx->parseStyles()

Or you can update the CreateTable.php file. In the generateP method you can use the following code:

protected function generateP($value = null, $options = null)
{
    if (!is_array($options)) {
        $options = array();
    }
    if (!isset($options['textProperties'])) {
        $options['textProperties'] = array();
    }
    
    $xmlWF = new WordFragment();
    $xmlWF->addText($value, $options['textProperties']);
    $xml = (string) $xmlWF;
    $this->_xml = str_replace('__GENERATETC__', $xml, $this->_xml);
}

This change to remove the PHP notice will be included in the next release of phpdocx.

Regards.