Home  >  Article  >  php教程  >  PHPWORD

PHPWORD

PHP中文网
PHP中文网Original
2016-05-25 16:58:321657browse

跳至

建立一个Word文件Template.docx
欲替换的值地方${name}
思路:
仿照smarty,
模板文件一定要命名为docx,后缀
前提,先下载开源类PHPWord,PHP开启ZIP拓展
loadTemplate('Template.docx');
        $document->setValue('name', 'xeay');
	$document->setValue('class', '软件一班');
	$document->setValue('No', '1108000xxxx');
	$document->setValue('telephone', '1885022xxxx');
	$document->setValue('why', 'ACM');
	$document->setValue('signname', 'xeay'); 
	$document->save('image.docx');
?>

                   

Statement:
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