PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.21k stars 2.68k forks source link

error: replace keywords of word #1406

Open rommer-luo opened 6 years ago

rommer-luo commented 6 years ago

image

Could not copy 'payment.docx' file to 'C:\Windows\Temp\PhpABD2.tmp'.

错误位置 FILE: D:\wamp64\www\sample\ThinkPHP\Library\Vendor\PHPWord\src\PhpWord\TemplateProcessor.php  LINE: 83

TRACE

0 D:\wamp64\www\sample\Application\Home\Controller\PaymentManagementController.class.php(118): PhpOffice\PhpWord\TemplateProcessor->__construct('payment.docx')

1 [internal function]: Home\Controller\PaymentManagementController->downPaymentLetter()

2 D:\wamp64\www\sample\ThinkPHP\Library\Think\App.class.php(164): ReflectionMethod->invoke(Object(Home\Controller\PaymentManagementController))

3 D:\wamp64\www\sample\ThinkPHP\Library\Think\App.class.php(202): Think\App::exec()

4 D:\wamp64\www\sample\ThinkPHP\Library\Think\Think.class.php(121): Think\App::run()

5 D:\wamp64\www\sample\ThinkPHP\ThinkPHP.php(97): Think\Think::start()

6 D:\wamp64\www\sample\index.php(25): require('D:\wamp64\www\s...')

7 {main}

my code: $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('payment.docx'); $templateProcessor->setValue('company', 'hahha'); $templateProcessor->setValue('money', 'hahha'); $templateProcessor->saveAs(ROOT.'/8888888888888888.docx');

so,I don't konw how to do?thank you

rommer-luo commented 6 years ago

How to use it in the thinkPHP3.2 framework. Can you give me a case? thank you

kevinfei520 commented 6 years ago

你的是什么问题?你可以直接给我发邮件

发自我的 iPhone

在 2018年6月7日,10:26,Rommer notifications@github.com 写道:

How to use it in the thinkPHP3.2 framework. Can you give me a case? thank you

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

cxkking commented 6 years ago

请问thinkphp 使用phpword replace 的问题解决了吗 我也遇到了这个问题 求助大家

rommer-luo commented 6 years ago

@cxkking 因为tp3.2 默认的类文件都是.class.php结尾的,所以引入的时候会有问题的,要么就是找到引入的地方,修改引入的文件的尾部标志。