PHP code example of molbio-unige / php-word-view

1. Go to this page and download the library: Download molbio-unige/php-word-view library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

molbio-unige / php-word-view example snippets


public function imprimatur()
{
    $imprimatur = '667';
    $this->viewBuilder()
         ->setClassName('PhpWordView.PhpWord');
         
    $data = [
        'title' => 'Beati Pauperes Spiritu,
        'imprimatur' => $imprimatur,
    ];
    $_serialize = 'data';
    $this->set(compact('data', '_serialize'));
}

public function imprimatur($id)
{
    $this->viewBuilder()
         ->setClassName('PhpWordView.PhpWord');
    $imprimatur = $this->Imprimaturs->get($id);
    $this->set(compact('imprimatur'));
}

    $this->viewBuilder()
         ->setClassName('PhpWordView.PhpWord')
         ->options([
             'wordConfig' => [
                 'filename' => 'imprimatur-' . $id,
             ]
         ]);


composer