Forum


Replies: 1   Views: 22
How to create a document from a template with the content of the file ( not a link to the file)

Posted by nonoxxxx  · 16-12-2024 - 15:44

Hello,

I 'am new to this library, and I don't find how to create a document by the content of the file ?

I 'am working on an app and we are using word template to generate some contracts while changing names and othe informations.

We are stocking these documents in the database so  they are not upladed on the server , on the PhpDocx Documentation only mention that : 

$docx = new CreateDocxFromTemplate('template.docx');

Is there a way to create the doc with the content of the file ? instead of the name/link

 

Thanks,

 

 

Posted by admin  · 16-12-2024 - 16:14

Hello,

phpdocx Premium licenses support using in-memory DOCX documents. On https://www.phpdocx.com/documentation/cookbook/in-memory-docx-documents you can read all information about this feature.

Please note that in-memory DOCX documents are not DOCX files as strings, but DOCXStructure objects (that can be serialized if needed). In your case, you need to generate the DOCX documents as files to read them with CreateDocxFromTemplate or create in-memory DOCX documents in the case of using a Premium license.

Regards.