In this new tutorial from InformBank posted today, they show how to use PHP (and a few handy tricks) to create Microsoft Office documents on the fly.
Sometimes you have to generate some MS Office document for the users of your website using dynamic data. For example, few days ago, I had to generate some Excel reports using data from some tables in MySQL. I knew about the COM but it has a lot of disadvantages, including Windows-only platform and not very high speed. CSV is much easier and faster but you can't format the cells to make them better-looking. The method I've never thought about before was using HTML.
So here came the inspiration and after some research and experiments I wrote this tutorial for all of you who are looking how to create Office documents on the fly using PHP. Of course, I included the COM methods and some methods to create other MS Office documents like DOC and PPT, to make this tutorial as full and as useful as possible.
The tutorial starts with the creation of documents (Word, Excel, Powerpoint) with the COM functionality (the standby method PHP has had for a while). Of course, it also requires the script to be running on Windows to work. So, what's the other option? As he goes on to explain, it's something as simple as HTML.
He includes two examples of alternate mathods, showing hhow to use HTML or a CSV file to create a custom Excel document. He also throws in some code to help you stream out the resulting document as a zip file to the browser.