I'm using code from http://forums.codeguru.com/archive/index.php/t-470940.html to create excel in php. Is there a way to add styles like bold and/or italic to cells when doing it that way? Thank you
Asked
Active
Viewed 5,402 times
0
-
And please only use the PHPExcel tag when referring to the PHPExcel library that creates actual .xls or .xlsx files, not when using other methods of creating a file that MS Excel can open – Mark Baker Jun 26 '12 at 12:08
-
The method shown in that thread does not generate an Excel .xls file. It generates a tab-separated-value file. This is a plain text format, that does not support styling of any kind – Mark Baker Jun 26 '12 at 12:12
-
As a clarification what @Mark said about tab-separated-value files, they are called TSV files, some are coma separated and called CSV, others are semicolon separated called CSV too. Any any case those kinds of files can't contain anything other than values. No styling, no calculation formulas. Nothing other that numeric/string values. – Mihai Stancu Jun 26 '12 at 12:14
1 Answers
4
The method shown in that thread does not generate an Excel .xls file. It generates a tab-separated-value file. This is a plain text format, that does not support styling of any kind
If you want to generate a real xls file with formatting, then look at some of the libraries that can be used from PHP to write actual Excel files such as my PHPExcel library
EDIT
In addition to PHPExcel, you can find details of other PHP libraries for writing real Excel files in the answer to this question

Community
- 1
- 1

Mark Baker
- 209,507
- 32
- 346
- 385
-
I've noticed that it requires PHP 5.2. I'm working on 5.1.6 so I can't use it. – Ales Jun 26 '12 at 12:28
-
You really shouldn't be using PHP 5.1.6 any more, it's long since unsupported... but some of the others listed in the link in my answer , such as the pear writer, will work with versions of PHP earlier than 5.2 albeit they don't have PHPExcel's feature set – Mark Baker Jun 26 '12 at 12:31