Closed igoroguraramos closed 3 years ago
`<?php include("lib/vendor/autoload.php");
use \PhpOffice\PhpWord\TemplateProcessor;
\PhpOffice\PhpWord\Settings::setZipClass(\PhpOffice\PhpWord\Settings::PCLZIP);
$templateProcessor = new TemplateProcessor("teste.docx"); $templateProcessor->setValue('nome', 'Igor Ogura Ramos'); $templateProcessor->saveAs("teste2.docx");`
Word archive incorret
<?php include("lib/vendor/autoload.php");
use \PhpOffice\PhpWord\TemplateProcessor;
\PhpOffice\PhpWord\Settings::setZipClass(\PhpOffice\PhpWord\Settings::PCLZIP);
$templateProcessor = new TemplateProcessor("teste.docx"); $templateProcessor->setValue('nome', 'Igor Ogura Ramos'); $templateProcessor->saveAs("teste2.docx");
error:
Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, int given in C:\xampp\htdocs\brax\app\lib\vendor\phpoffice\phpword\src\PhpWord\Shared\ZipArchive.php:387 Stack trace: #0 C:\xampp\htdocs\brax\app\lib\vendor\phpoffice\phpword\src\PhpWord\Shared\ZipArchive.php(387): count(0) #1 [internal function]: PhpOffice\PhpWord\Shared\ZipArchive->pclzipLocateName('word/header1.xm...') #2 C:\xampp\htdocs\brax\app\lib\vendor\phpoffice\phpword\src\PhpWord\Shared\ZipArchive.php(115): call_user_func_array(Array, Array) #3 C:\xampp\htdocs\brax\app\lib\vendor\phpoffice\phpword\src\PhpWord\TemplateProcessor.php(119): PhpOffice\PhpWord\Shared\ZipArchive->call('locateName', Array) #4 C:\xampp\htdocs\brax\app\index.php(8): PhpOffice\PhpWord\TemplateProcessor->construct('teste.docx') #5 {main} thrown in C:\xampp\htdocs\brax\app\lib\vendor\phpoffice\phpword\src\PhpWord\Shared\ZipArchive.php on line 387
Help please