Pregunta: | 68283 - ESCRIBIR DATOS EN LAS SIGUIENTES HOJAS DE UN ARCHIVO EXCELL |
Autor: | Hildefonso Chaverra |
Gracias de antemano por su ayuda Ya se como crear un archivo EXCEL u OpenOficce, el punto es que todo sale en una misma hoja del archivo y ustedes saben que la hoja de cálculo tiene diferentes pestañas. Dejo mi código para que me ayuden por favor. <?php $filename = "RESULTADOS.ODS"; // Cabecera para crear un archivo de OpenOffice la de excel es muy comun. header("Content-Disposition: attachment; filename=$filename"); header("Content-Type: application/vnd.oasis.opendocument.spreadsheet"); $conexion = mysql_connect("localhost", "root", ""); mysql_select_db("ACTIVIDADES",$conexion); $sql = "SELECT count(*) from ACTIVIDADES"; $result = mysql_query($sql); $respuesta = mysql_fetch_array($result); $hay_datos = $respuesta[0]; if ($hay_datos > 0){ echo "<table> <tr> <td colspan='4' align='center'><font color='blue'>LISTA DE ACTIVIDADES 2013</font></td> </tr> <tr> <td align='center'>MES</td> <td align='center'>ACTIVIDAD</td> <td align='center'>TIEMPO ESTIMADO</td> <td align='center'>RESPONSABLE</td> </tr>"; $sql = "SELECT * from ACTIVIDADES"; $result = mysql_query($sql); while($campos = mysql_fetch_array($result)){ echo "<tr> <td>" . $campos['mes'] . "</td> <td>" . $campos['descripcion'] . "</td> <td>" . $campos['tduracion'] . "</td> <td>" . $campos['instructor'] . "</td> </tr>"; } echo "</table>"; } ?> |