Forum


Replies: 4   Views: 63
Error while trying to open the (base) template as a zip file

Posted by nhupv  · 08-01-2019 - 04:05

hello, i am trying to open a docx template file but i get the error message: Error while trying to open the (base) template as a zip file

I am using  codeigniter framework.How to solve this problem?

here is my code in controller: 

public function createdocx()
    {
        $docx= new CreateDocxFromTemplate('../../upload_files/Template.docx');
        $docx->replaceVariableByText(array('nameReport' => 'John Smith'));
        $docx ->createDocx('helloword');
    }

 Template.docx is saved in the upload_files folder outside the controller directory .

Posted by admin  · 08-01-2019 - 07:17

Hello,

What license and version of phpdocx are you using? If you are using the trial package we recommend you to test it standalone.

That error appears when you try to open a file that is not a DOCX document or the file doesn't exist, maybe the path to the file isn't correct.

Regards.

Posted by nhupv  · 08-01-2019 - 10:02

i am using the trial package.everything is right but i get the error message:Error while trying to open the (base) template as a zip file

I suggest the following cases: 

  • zip library is not enabled.how to enable?
  • the path to the file isn't correct.can you give me an example?

Posted by nhupv  · 09-01-2019 - 11:46

Hello,

I fixed the error. Thank you for your help.