Membuat File Excel Dengan PHP
Surabaya – Barusan aku search ke Google bagaimana cara membuat file excel dengan php, setelah buka sana buka sini akhirnya aku menemukan cara termudah untuk membuat file excel dengan php. Berikut adalah contoh coding php yang mungkin bisa dikembangkan lagi.
<?php
header(“Cache-Control: no-cache, no-store, must-revalidate”);
header(“Content-Type: application/vnd.ms-excel”);
header(“Content-Disposition: attachment; filename=namaFile.xls”);
//isi file excel (pakai tabel)
$asia = array(“Indonesia”, “Malaysia”, “Philipine”, “Brunai”, “Thailand”, “Laos”, “Vietnam”, “Timor Leste”);
echo “<table border=”1″>
<tr>
<td>No</td>
<td>Negara</td>
<td>Ket</td>
</tr>”;
$no = 1;
for($i=0; $i<count($asia); $i++)
{
if($i%2==0)
$b = “red”;
else
$b = “”;
echo “<tr>
<td bgcolor=”.$b.”>”.$no.”</td>
<td bgcolor=”.$b.”>”.$asia[$i].”</td>
<td bgcolor=”.$b.”>-</td>
</tr>”;
$no++;
}
echo “</table>”;
//bisa juga pakai Xml
?>
Atau dowload aja file yang sudah aku baut ini [download]




January 23rd, 2009 at 11:33:17
o…this is the mayor cause u ignore me that day..hm…
June 16th, 2010 at 23:21:13
itu script serius udah dCoba blum kk…??
trs download linkN g bs kyN…
June 20th, 2010 at 23:09:29
bro, script sudah aku coba, oya di copy paste aja, accountku di live.com mati sehingga gak bisa didownload.