Forum


Replies: 4   Views: 3315
Styles
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 DanD  · 11-04-2013 - 12:12

Your response to look at the documentation is a little dismissive:) I see nothing among the examples that does what I'm trying to do -- create a custom style and then apply it to text. As I said, every example seems to do only direct inline styling of text. I want to add a style, and then apply it. I see how to add a style with this.

[code]
$aNewStyle = new CreateStyle();
$myParameters = array('type' => 'paragraph',
'styleId' => 'myStyle',
'name' => 'myStyle',
'customStyle'=> 'true',
'basedOn' => 'Normal',
'next' => 'Normal',
'keepNext' => 1, 'keepLines' => 1, 'spacing_before' => '200',
'spacing_after' => '0',
'b' => 1);
$aNewStyle->addStyle(array($myParameters));
$docx->setXmlWordStyles($aNewStyle);
[/code]

However, I don't see how I can apply the style to text using any of the public methods. Admittedly, I'm no genius programmer, so an example on this might help some people, including myself!