I want to replace the variable (test_var) inside the document, i can create a table and add texts to it with addText, but the addImage method is not adding the image.
Here is my code:
$template = new \PhpOffice\PhpWord\TemplateProcessor("test.docx");
$table = new \PhpOffice\PhpWord\Element\Table();
$table->addRow();
$table->addCell()->addText("test");
$table->addCell()->addImage("test.png");
$template->setComplexBlock('table_var', $table);
$template->saveAs("test_.docx");
- PHP version: 7.4
- PhpWord version: 0.17.0
Specify the absolute path to the file and everything will work