PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
basher400
Forum Newbie
Posts: 5 Joined: Mon Mar 27, 2006 1:17 am
Post
by basher400 » Sun Jun 04, 2006 8:32 am
hi
here is a nice code to generate an .xls file
(the problem I need help with follows) :
Code: Select all
$line1="ID\tProduct\tColor\tSales\t";
$line2="1\tPrinter\tGrey\t13\t";
$line3="2\tCD\tBlue\t15\t";
$line4="3\tDVD\tRed\t7\t";
$line5="4\tMonitor\tGreen\t4\t";
$line6="5\tTelephone\tBlack\t2\t";
$data="$line1\n$line2\n$line3\n$line4\n$line5\n$line6\n";
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment;filename=extraction.xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data";
I need to make the generated file in the charset of "UTF-8", anyone has an idea how and where I need to set this in the php code?
ok
Forum Contributor
Posts: 393 Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land
Post
by ok » Sun Jun 04, 2006 9:15 am