Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/07/2007, 18:50
Avatar de Degz
Degz
 
Fecha de Ingreso: marzo-2004
Ubicación: Popayan
Mensajes: 10
Antigüedad: 20 años, 1 mes
Puntos: 0
problemas con excel y php

hola,
Agradezco de ante mano su atencion.
Sucede que estoy haciendo una aplicacion pra listar ciertas cosas de una base de datos. El problema es que quiero que las tablas que he hecho abran con excel. He averiguado que una cabecera en php como esta:

header('Content-type: application/vnd.ms-excel');
header("Content-Disposition: attachment; filename=Estudiantes.xls");
header("Pragma: no-cache");
header("Expires: 0");


hace abrir la tabla en excel , pero el gran problema es que a mi no mefunciona!!!!!. Aparece un warning :

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp.... \archivo.php).

probe con un archivo :
<?php
header('Content-type: application/vnd.ms-excel');
header("Content-Disposition: attachment; filename=Estudiantes.xls");
header("Pragma: no-cache");
header("Expires: 0");

echo "<table border=1>";
echo "<tr>";
echo "<th>Titulo</th>";
echo "<th>URL</th>";
echo "</tr>";
echo "<tr>";
echo "<td><font color=red>Nolimites</font></td>";
echo "<td>www.nolimites.com</td>";
echo "</tr>";
echo "<tr>";
echo "<td><font color=red>Google</font></td>";
echo "<td>www.google.com</td>";
echo "</tr>";

echo "</table>";
?>

y funciona pero despues hago lo suguiente:
1.copio un codigo como este:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2. hago correr la aplicacion.
3 me aparece el warningde arriba.
4. quito el codigo de html de cabecera, y se supone que deberia funcionar normamente pero me sigue a pareciondo el warning.

este es mi problemilla y agrdezco nuevamente su ayuda.