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.

Setting properties and defaults in PHPExcel

Setting properties and defaults in PHPExcel - PHP Tutorial

From the course: PHP: Exporting Data to Files

Start my 1-month free trial

Setting properties and defaults in PHPExcel

We're going to use PHPExcel to export the used cars data to an Excel spreadsheet. But before diving into the code, let's take a look at the finished file. It's cars.xlsx, which you can find in the exercise files for this video. I'm opening it in Microsoft Excel, but you can also open this file in OpenOffice Calc. The data is nicely formatted with the headings in bold type and the data vertically aligned in each cell. Most of the columns are centered but the make column and description are left aligned. The data in the mileage column has been formatted with thousand separators. And the price column has been formatted as dollars. The font has been set to Lucida Sans Unicode. Let's take a look at the print preview. The page is in landscape orientation, with a header and a footer. In fact, the content has been scaled to fit the width of the page. This looks a lot more professional than the CSV output that we saw in Chapter Two. But, it does involve writing considerably more code. In your…

Contents