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.
Formatting columns in PHPExcel - PHP Tutorial
From the course: PHP: Exporting Data to Files
Formatting columns in PHPExcel
Let's take another look at the finished spreadsheet that we are creating with php xl. The default horizontal alignment in each cell has been set to center, but columns B and G are left aligned. The text in column G has also been wrapped so that long lines don't extend beyond the column width. If I just zoom out a little you can see that better. The mileage values in column D have been formatted with a thousands separator and the prices in column F have been formatted as currency with a dollar sign, a thousands separator, and two decimal places. So we need to make a note of those columns and format them. Let's go back to our editing program and work with PHPExcel. The code needs to go at the bottom of the tribe lock after the code that we created in previous videos, so I'm just going to add in a couple of more lines and start work on line 54. To format a column, you need to apply the getStyle method to the active sheet and specify a range of cells. You specify a range in exactly the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Introducing PHPExcel3m 31s
-
(Locked)
Setting properties and defaults in PHPExcel6m 58s
-
(Locked)
Setting the spreadsheet's print options5m 59s
-
(Locked)
Populating an Excel spreadsheet with data7m 46s
-
(Locked)
Formatting columns in PHPExcel5m 47s
-
(Locked)
Downloading the data as a .xlsx file5m 18s
-
(Locked)
Creating a spreadsheet in the OpenDocument format3m 4s
-
(Locked)
Creating columns and headers in Fusonic SpreadsheetExport6m 26s
-
(Locked)
Adding the data and downloading as a .ods file6m 52s
-
(Locked)
-
-
-
-
-