2014-09-04 572 views
0

我在PHPWord中的setValue()函數有問題。通常,參數應該是一個純文本變量,但在這種情況下,我必須處理一個html塊。而PHPWord無法將html標籤解析爲word xml。用PHPWord替換html實體setValue函數

我的意思是,以取代這個網站: enter image description here

到Word模板: enter image description here

使輸出這樣的: enter image description here

有沒有什麼解決辦法嗎?

回答

0

在設置var之前,您可以使用utf8_decode或htmlentities函數。 例如:

$document->setValue('cif', utf8_decode($cif)); 
$document->setValue('cif', htmlentities($cif)); 
+0

能否請您詳細闡述更多的答案增加關於您所提供的解決方案多一點的描述? – abarisone 2015-04-15 13:27:50