en mi RecordViewer (
http://mickel.biz//comments.php?id=94_0_1_0_C )uso esto:
Código PHP:
<?php
$sqryvar="Select (campos) from (table) (where) (order)...";
$iqryvar=mysql_query($sqryvar);
if ($iqryvar>0) {
$shtml="<table><tr>";
$fields=mysql_num_fields($iqryvar)
for ($i=0; $i < $fields; $i++) {
$shtml=$shtml."<td>".mysql_field_name($result, $i)."</td>";
}
$shtml=$shtml."</tr>";
while ($row = mysql_fetch_row($result)) {
$shtml=$shtml."<tr>";
for ($f=0; $f < $fields; $f++) {
$shtml=$shtml."<td>".$row[$f]."</td>";
}
$shtml=$shtml."</tr>";
}
$shtml=$shtml."</table>";
}
if (strlen($shtml)>0) {
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=report.xls");
header("Pragma: no-cache");
header("Expires: 0");
echo $shtml;
}
espero que te sirva...