Download the PHP package molbio-unige/php-word-view without Composer
On this page you can find all versions of the php package molbio-unige/php-word-view. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download molbio-unige/php-word-view
More information about molbio-unige/php-word-view
Files in molbio-unige/php-word-view
Package php-word-view
Short Description PhpWordView plugin for CakePHP
License MIT
Informations about the package php-word-view
PhpWordView plugin for CakePHP
This plugin renders Word documents using the PhpWord library. This plugin uses the TemplateProcessor
of PhpWord.
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
Enable plugin
Load the plugin by running command
Usage
Two different ways to render.
PHPWord TemplateProcessor
To be used if you need to render simple documents. Serialize the data you want to insert into the template.
The templates are expected to be present in src/Templates/Model/docx/
, and having .docx
filename extension. Template files are just plain word document, not Word model documents.
PHPWord full api
To be used when a simple search-replace is not sufficient.
The view files are expected to be present in src/Templates/Model/docx/
, but having .ctp
filename extension. Inside your view files you will have access to the PHPWord library with $this->PhpWord
. Check the PHPWord documentation on how to use PHPWord.
Don't set the _serialize
variable.
Downloaded filename
The downloaded filename can be specified with the viewBuilder options, default is the action name.
Troubleshooting
A Could not close zip file /tmp/PhpWord5gJC0Z
Exception might mean that there is a problem with the template.docx file have incorrect line ending. This can be solved by specifying docx files as binary in the .gitattributes
file.