Forum


Replies: 1   Views: 3369
Replacevariablebyhtml and special chars
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 michealorion  · 05-12-2016 - 10:08

Hello

I have this HTML string converted by php function htmlentities

string(92) "<p>This special chars à è ì ù ò<br></p>"

When i use the function replaceVariableByHtml in output document there is the strings with all html tags like when i use replaceVariablebyText

this is my code:

require_once '../../core/com/phpdocx/classes/CreateDocx.inc';
$docx = new CreateDocxFromTemplate('template/template.docx');
$variabiliTemplate=$docx->getTemplateVariables();
//get my template varables
$sostituzioniDaModello = $memo->audit->getElementiModelloProgetto($proj->idmodello);
foreach ($sostituzioniDaModello as $index => $field){
   if(in_array($field,$variabiliTemplate['document'])){
        //get value of element and parse htlm
        $html = htmlentities($proj->getElemento($index)); 
        $docx->replaceVariableByHtml($field,'block',$html); 
    }
}
$docx->createDocx('template/documento.docx');


Can i help me?

Thanks for support