Forum


Replies: 1   Views: 322
How do i add images to the end of a document
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 08-05-2023 - 15:23

Hello,

By default, all contents are added at the end of the document.

For example, generating a new DOCX with a text and an image:

$docx = new CreateDocx();

$docx->addText('My paragraph');

$docx->addImage(array('src' => 'image.png'));

And the same using an existing DOCX:

$docx = new CreateDocxFromTemplate('document.docx');

$docx->addText('My paragraph');

$docx->addImage(array('src' => 'image.png'));

When you use an existing DOCX with CreateDocxFromTemplate all contents are kept. New contents are added at the end of the document using methods such as addText or addImage.

Regards.