Forum


Replies: 1   Views: 3349
Createparagraphstyle error
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 ironinthesoul  · 20-11-2015 - 03:02

I am adding styles to a CreateDocx object. The styles are in an array that gets looped over:

        $arr = array(
            'mainhead'         => array(
                                'font'            => 'Trebuchet MS',
                                'color'         => '000000', 
                                'sz'             => 24,
                                'b'                => true
                            ),
            'parthead'        => array(
                                'font'            => 'Trebuchet MS',
                                'color'         => '000000', 
                                'sz'             => 18,
                                'b'                => true
                            )
        );

like so:

        foreach($arr as $key=>$value) {
            $docx->createParagraphStyle($key, $value);        
        }

But, it is resulting in an error for each iteration:

Notice (8): Undefined index: pStyle [APP/Lib/DocularToDocx/Lib/phpdocx-pro-5.0/classes/AutoLoader.inc(62) : eval()'d code, line 65]

The code is otherwise producing a Docx file correctly, except the styles are not being applied.

Using the option keys in the addText() styles (fontSize instead of sz) results in the same error.

Is anyone experiencing the same problem? Does anyone have a solution? I'm not able to find one.