首頁 >後端開發 >php教程 >【PHPWord】从模板创办Word

【PHPWord】从模板创办Word

WBOY
WBOY原創
2016-06-13 11:33:041136瀏覽

【PHPWord】从模板创建Word

源文件

生成


require_once 'PHPWord.php';$PHPWord = new PHPWord();$document = $PHPWord->loadTemplate('Template.docx');$document->setValue('Value1','Sun');$document->setValue('Value2','SNK');$document->setValue('Value3','MArs');$document->setValue('Value4','Earth');$document->setValue('Value5','Uranus');$document->setValue('Value6','Pluto');$document->setValue('Value7','Neptun');$document->setValue('Value8','Mercury');$document->setValue('Value9','Jupiter');$document->setValue('Value10','Plutos');$document->setValue('weekday',date('1'));$document->setValue('time',date('H:i'));<span style="color:#ff0000;">//保存文件$document->save('FromTemplate.docx');</span>


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn