Forum


Replies: 6   Views: 4060
Html to word style setting problem
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 Sven May  · 07-05-2015 - 09:06

Hello! I use the following code: $docx = new CreateDocxFromTemplate($template); $docx->embedHTML('

'.$htmlCode.'

', array('strictWordStyles'=>true, 'wordStyles'=>array('

'=>'description', '
  • '=>'descriptionList'))); Both style - description and descriptionList is based in word template what I use. I read this page: http://www.phpdocx.com/documentation/introduction/html-to-word-PHP Found that solution where use HTML tag to set which stlye shold be get on...but it is not work :( If I use class like this: '

    '.$htmlContent.'

    ' then I define style useing like this: 'wordStyles'=>array('.desc_content'=>'description', .... it is work I can not find whats worng...what I am using wrong because both styles not manage to enforce...

    Posted by Sven May  · 08-05-2015 - 06:31

    So...this question could be ridiculous or incomprehensible or any other thing? In other case I got answer in a couple hours...

    Posted by admin  · 08-05-2015 - 08:03

    Hello, Please send to contact[at]phpdocx.com the most simple script that illustrates your issue and the template. As we need to run this script, it can't do external connections such as databases or web services. Regards.

    Posted by Sven May  · 08-05-2015 - 09:17

    Thanks! I sent an e-mail!

    Posted by Sven May  · 08-05-2015 - 10:04

    Actually I runned your exmaple codes! Copy from this page: http://www.phpdocx.com/documentation/introduction/html-to-word-PHP sectoin: Using native Word formatting with HTML source code. Run it and in $wordStyles = array('[table TAG open-close]' => 'LightListAccent3PHPDOCX', '[h1 TAG open-close]' => 'Heading2PHPDOCX' , '.heading2' => 'Heading2PHPDOCX'); '[h1 TAG open-close]' => 'Heading2PHPDOCX' part is not work. The .heading2 is fine but the TAG using is not! Tha base source code was example/Core/embedHTML/sample_1.php I just modified the cvode from the mentioned page....

    Posted by admin  · 08-05-2015 - 10:49

    Hello, You have been replied by email; please don't mix the messages. All website and package samples work perfectly. Regards.

    Posted by Sven May  · 08-05-2015 - 11:12

    I got your answer and you are right! It wasn't any answer about our letter...and the code not work! I am sure. I checked it 2 times...