This topic is locked

Documents and reports in WORD

3/11/2023 8:15:12 AM
PHPRunner Tips and Tricks
fhumanes author

img alt
Surely many of you have been trying the solution to create Word documents from PHP, to create (invoice, records, communications, etc.), in general, documents with very good results, since this is a simple and very powerful method, due to the quality the design of these documents.
Even the end user or recipient of the solution can design the Word document that we can use for the application with very few adaptations.
Also, a few months ago version 1.0.0 came out, with new features and I thought about making 2 examples, so that you can appreciate the potential and simplicity of the solution.
Aim
1.- Have a more complete example of preparing "invoice" documents. Possibility of obtaining one by one or having a single document with multiple invoices. Also, as an example, the dynamic preparation of a QR with the invoice data is included and it is included in the document.
DEMO : https://fhumanes.com/invoice_word/
Technical Solution
For the examples I have used 3 PHP libraries:
PHPWord. [https://github.com/PHPOffice/PHPWord](https://github.com/PHPOffice/PHPWord) Composition of Word documents starting from templates. docx-merge. [https://packagist.org/packages/mrdreek/docx-merge](https://packagist.org/packages/mrdreek/docx-merge) I use it to compose a single document with pieces or partial Word documents. QR-code. [https://github.com/endroid/qr-code](https://github.com/endroid/qr-code) I use it to generate QR graphics.By requirement of these libraries, the solution works with PHP 8.1 or higher.
In the first example, the aspect of the solution is:
img alt
On the invoice display page I have placed a button to obtain the Word of that invoice.
img alt
If you are interested in this topic, click on this link to get all the information .