Forum


Replies: 3   Views: 3626
Embedhtml: override paragraph 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 larrytech  · 20-02-2015 - 09:45

When using the embedHTML function, is there a way to override the default styles? For example: at the moment I have the following (where the article content is Markdown): http://pastebin.com/uDjM7wwV Is there a better way to do this?

Posted by admin  · 20-02-2015 - 10:19

Hello, The embedHtml method has these options to preserve or ignore the styles: * 'strictWordStyles' (boolean) if true ignores all CSS styles and uses the styles set via the wordStyles option (see next) * 'wordStyles' (array) associates a particular class, id or HTML tag to a Word style Regards.

Posted by larrytech  · 20-02-2015 - 10:24

Thanks! I've been trying this but I can't seem to make it work. I have the following code: http://pastebin.com/SDhKiDjK However, where I'm setting the text as size 10, Trebuchet MS, it's coming out in the Word document as size 12, Times. Have I misunderstood how this functionality works? Many thanks

Posted by admin  · 20-02-2015 - 10:58

Hello, You need to set the full tag in the wordStyles, not only its name. For example <p> instead of just p The tutorial on: http://www.phpdocx.com/introduction/tutorial has an example of this. Regards.