0

Im creating a custom php project that export docx file using https://github.com/PHPOffice/PHPWord. After successfully testing it on my localhost, i deployed it in the server, but unfortunately, im receiving this error:

The file PhpOffice\PhpWord\TemplateProcessor.php is missing in the includes folder.

This is how im calling the files

$file_name = dirname(__FILE__).'/template/template.docx';
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($file_name);

I have tried several methods from stackoverflow, but still couldn't fix it.

Could somebody please help me with this issue?

1 Answers1

0

I solved it by installing

composer require phpoffice/phpword

and then

require_once $_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php';
$file_name = dirname(__FILE__).'/template/template.docx';
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($file_name);