Foros del Web » Programando para Internet » PHP »

creando excell desde php

Estas en el tema de creando excell desde php en el foro de PHP en Foros del Web. buenas tengo unos archivos que me crean el xls con el siguiente codigo: Código PHP: ob_start ();  echo  "&nbsp;<center><table border=\"1\" align=\"center\">" ;  //echo "<tr> //<td></td><td><font color=\"#000000\"><strong>informe sobre l'ultim control:</strong></font></td>  //</tr>";    echo  ...
  #1 (permalink)  
Antiguo 22/05/2009, 08:59
 
Fecha de Ingreso: abril-2008
Mensajes: 144
Antigüedad: 16 años, 1 mes
Puntos: 1
Pregunta creando excell desde php

buenas tengo unos archivos que me crean el xls con el siguiente codigo:



Código PHP:
ob_start(); 
echo 
"&nbsp;<center><table border=\"1\" align=\"center\">"
//echo "<tr>
//<td></td><td><font color=\"#000000\"><strong>informe sobre l'ultim control:</strong></font></td> 
//</tr>"; 
 

echo "<tr bgcolor=\"#336666\"> 
  <td><font color=\"#ffffff\"><strong>CODI</strong></font></td> 
  <TD><font color=\"#ffffff\"><strong>TESTDIM</strong></font></TD> 
  <td><font color=\"#ffffff\"><strong>LLET</strong></font></td> 
  <td><font color=\"#ffffff\"><strong>GRASA</strong></font></td>
  <td><font color=\"#ffffff\"><strong>CELULES</strong></font></td>
  <td><font color=\"#ffffff\"><strong>PROTEINES</strong></font></td>
  <td><font color=\"#ffffff\"><strong>LACTACIO</strong></font></td>
  <td><font color=\"#ffffff\"><strong>ULTIM PART</strong></font></td>
  
</tr>"

while(
$row=mysql_fetch_array($result)) 
{   
    echo 
"<tr>";   
     for(
$j=0$j<$campos$j++) {   
         echo 
"<td>".$row[$j]."</td>";   
     }   
     echo 
"</tr>";         
}   
echo 
"</table>"

$reporte ob_get_clean();
/******************************************** 
Set the automatic downloadn section 
/********************************************/

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

echo 
$reporte
la question no es tècnica es màs bien... que me gustaria saber que tipo de libreria estoy utilizando.. que hace la funcion ob_start(); y estos header? y esto ya biene incorporado en php=?

en definitiva porque usamos esto, y de donde viene, tengo que explicarlo en un trabajo :P

gracias :P
  #2 (permalink)  
Antiguo 22/05/2009, 09:05
Avatar de ACX_POISON  
Fecha de Ingreso: abril-2008
Ubicación: Talca-Chile
Mensajes: 750
Antigüedad: 16 años
Puntos: 7
Respuesta: creando excell desde php

segun tengo entendido basta crear tablas en html y agregarle las cabeceras correspondientes y quedan listos para verse con el excel

lo que hace los header es eso asignar las cabeceras necesarias para que el navegador interprete que debe visualizarse com .xls....

ojala te sirva
__________________
Me junto con los que Saben, Queriendo Saber.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:16.