From the course: PHP: Exporting Data to Files

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating columns and headers in Fusonic SpreadsheetExport

Creating columns and headers in Fusonic SpreadsheetExport - PHP Tutorial

From the course: PHP: Exporting Data to Files

Start my 1-month free trial

Creating columns and headers in Fusonic SpreadsheetExport

This is cars_open.php, which you can find in the exercise files for this video. Fusonic Spreadsheet Export uses namespaces, so the code on lines two to five includes the PSR4 auto-loader, and registers the Fusonic namespace as described in chapter one. Lines seven to 11 import the classes we'll be needing. There are five altogether. The first one is for the spreadsheet. Then three for different types of column. And the last one is the writer that creates the download file. The rest of the page is the same as in previous exercises. It queries a database to get details of used cars, and displays them in the web page which has a button at the bottom to generate a download file. Line 13 includes the database query and the custom get row function that was defined in chapter one. The version I'm using is for MySQL Improved. If you're using SQLite, or a different database, change MySQLI to PDO. Also make sure that you've got installed the class definitions in the SRC folder Foundation.php…

Contents