K
K
kickass772022-02-17 16:01:04
PHP
kickass77, 2022-02-17 16:01:04

How to work with Word Template Engine correctly?

https://github.com/philip-sorokin/word-template-engine

<?php
// Подключите библиотеку
require_once 'WordTemplateEngine.php';

$doc = '/var/www/file.docx';
$template = new WordTemplateEngine($doc);


$varName = 'name';
$replacement = 'Мое новое имя';

$template->setValue($varName, $replacement);

$template->save('/var/www/file_new.pdf', 'pdf');

$template->output('pdf', 'Invoice 777', true);

?>


In docx, set ${name}

I get an error: Fatal error: Uncaught Error: Call to a member function getElementsByTagName() on null

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question