Forum


Replies: 4   Views: 3294
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  · 13-05-2011 - 18:52

The documentation is very minimal. I'm expecting to find a way to define a style, and then to use the style name to assign it to text that I add using addText(). I don't see that anywhere. In the examples I see nothing but direct styling of text. Is there an example that does what I'm looking for, or is this not even possible?

Posted by admin  · 11-04-2013 - 12:12

Hello,

Please check phpdoc,

http://www.phpdocx.com/phpdoc_pro/

almost every option is included in this doc.

Regards.

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!

Posted by admin  · 11-04-2013 - 12:12

Hello,

Sorry, I didn't mean just to look doc. Phpdoc include examples and before each method there's a list of values.

We're going to add a new file with that example.

Regards.