Home > Backend Development > PHP Tutorial > 【PHPWord】从模板创办Word

【PHPWord】从模板创办Word

WBOY
Release: 2016-06-13 12:36:32
Original
1166 people have browsed it

【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>
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template