superipey/phpword

Based on PHPOffice/PHPWord, some code modification for Any Image in Document to be recognized in TemplateProcessor

dev-master 2017-12-08 13:43 UTC

This package is not auto-updated.

Last update: 2025-03-27 19:21:13 UTC


README

This is only Modified PHPWord library based on PHPOffice/PHPWord library. I just put some modification in Word TemplateProcessor to recognize Images as a Template in the Document.

Thank you

Installation

This library is installed via Composer. To add a dependency to PHPWord in your project, either

Run the following to use the latest master version

    composer require superipey/phpword:dev-master

You can of course also manually edit your composer.json file

{
    "require": {
       "superipey/phpword": "dev-master"
    }
}

Getting Started

First Step

To try this library modification, first create the template with the image placed anywhere in your document, right click on the image, then select Format AutoShape/Pictures Figure 1

Second Step

Type your fieldname in the Alternative text Figure 2

Third Step

Use setImageValueAlt to set the image

$template->setImageValueAlt(field, path-to-file);

Example:

$template->setImageValueAlt("foto", "./uploads/foto/ferry.png");

License

PHPWord is an open source project licensed under the terms of LGPL version 3. PHPWord is aimed to be a high quality software product by incorporating continuous integration and unit testing. You can learn more about PHPWord by reading the Developers' Documentation and the API Documentation.