A
A
Alexey2017-10-06 17:32:22
Domain Name System
Alexey, 2017-10-06 17:32:22

How to add value to document template using PhpWord loadTemplate and setValue?

Using this code gives an error

$PHPWord = new PHPWord();
$doc = $PHPWord->loadTemplate($template);
$section = $PHPWord->createSection();
$section->addText('bla bla bla');

$doc->setValue('object', $section);
$doc->save($tempFile);

gives an error message:
[ErrorException] E_RECOVERABLE_ERROR
Object of class PHPWord_Section could not be converted to string (0)
/www/local/libs/classes/PHPWord/Template.php:105
#0: str_replace(string, string, string)
  /www/local/libs/classes/PHPWord/Template.php:105
#1: PHPWord_Template->setValue(string, object)
  /www/local/page/kp/index.php:189

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Berkutman, 2019-06-30
@Berkutman

You need to transfer your domain to your DNS server in the digitalocean control panel. or another third-party DNS server and enter a record of type A or AAAA (where A is Ipv4, and AAAA Ipv6) the public address where your site or other resource hangs.
Alternatively, you can do it through CloudFlare.
Example article: https://hostiq.ua/wiki/dns-hosting-cloudflare/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question