Quizas esto te sirva, es de un reporte que genera un sistema que hice:
Código PHP:
Ver originalheader('Content-type: application/vnd.ms-excel'); header("Content-Disposition: attachment; filename=$nombre.xls");
echo "<table border=1>\n";
echo "<tr>\n";
for ( $i = 0; $i < $field; $i++ )
{
}
echo "</tr>\n";
echo "<tr>\n";
{
for ( $i = 0; $i < $field; $i++ ) {
echo "<td><font color=black>".$Rs2[$i]."</font></td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";