📜 ⬆️ ⬇️

Document generator docx and xlsx

image

A year ago, a regular customer once again addressed me. “Managers are idiots,” he said indignantly. - The staff turnover is huge, it takes months to train everyone. And then they make mistakes. ”

Only after such an emotional prelude did the task follow: “It is necessary that when ordering from the site, an already formed package of documents in MS Office formats should arrive: an order form, an invoice for payment, a receipt, and a specification”.

The task itself is close to the article "PHP + Word" . But the LiveDocx service did not suit us. First, it was assumed that most of the documents should be in Excel. Secondly, payment "to the West" from Russia was and is problematic. Thirdly, the customer had a lot of ideas and helpers that this or a similar service would hardly have realized. For example, a complex table, with a breakdown of goods into categories.
')
Since there are several websites at the customer, it was decided to build a separate system - its own document generation service, to which the websites would apply at the time of the order.

The basis of the future code was the ideas from the same Habrostat above, as well as the publication “Disassemble xlsx in PHP without ready libraries” .

As a result, for the month of work, the “document generator” was created and launched.

What he can do:



What the generator currently does not know how:


In this form, he worked for a year now. Problems for this period arose mainly only with the client part - from the store. Although this does not mean that the script "generator" is perfect. Today it is run in only one real task.

Soon the idea arose that this product could be useful to other people. So, a new domain was registered, a copy of the document generator was installed on it and a small website was created on which you can “touch” the script, fill in your template and exploit it until it withstands the iron .

Today I received permission from the customer to post a project on Gitkhab and publish this article, which I hasten to use.

Check the script can be a demo example .

The source code is available in the repository .

Source: https://habr.com/ru/post/254537/


All Articles