PHP code example of jupitern / docx
1. Go to this page and download the library: Download jupitern/docx 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/ */
jupitern / docx example snippets
$dir = 'C:\\www\\docx\\';
// Docx template
$docx = \Jupitern\Docx\Docx::instance()
->setTemplate($dir.'template.docx')
->setData(['{name}' => 'john doe', '{address}' => 'at the end of the road'])
->save($dir.'result.docx');
// Merge Docx files
$docxMerge = \Jupitern\Docx\DocxMerge::instance()
// add array of files to merge
->addFiles([$dir.'file1.docx', $dir.'file2.docx'])
// output filepath and pagebreak param
->save($dir.'result.docx', true);