I need to export the output of php script to xls or csv file. Output file must be formatted (font size, font weight, borders etc).
I have two options:
- content variable as string with html tags (formatted text)
- an array with data ready to be formatted
The easiest way I think is to export variable containing html code strict to xls file which I just did. The only problem is when I download xls file and open it, Excel alerts me that opened file format is different that file extension.
Headers in my php script:
header("Content-Type: application/xmls.ms-excel");
header("Content-Disposition: attachment;filename=test.xls");
header("Content-Transfer-Encoding: binary");
Charset is set to UTF-8.
Also I'm able to use array variable with data that I need to put in cells, but:
- I don't know how to format cells (fonts, borders etc)
- I don't know how to put data in exact cell
- I'm not able to use PEAR and Spreadsheet_Excel_Writer
Any further help will be appreciated.