Forum


Replies: 3   Views: 2117
Parsestyles returns a php notice
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  · 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.