Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/09/2011, 08:54
tmgguru01
 
Fecha de Ingreso: junio-2010
Mensajes: 59
Antigüedad: 13 años, 11 meses
Puntos: 1
Respuesta: Escribir ecuaciones en Excel con PHP

Tengo tres archivos para la operacion que funciona perfectamente:

Pagina_Principal.php

...

(1)
<head>
<script type="text/javascript">
$(document).ready(function() {
$(".botonExcel").click(function(event) {
$("#datos_a_enviar").val( $("<div>").append( $("#resumen_electsen").eq(0).clone()).html());
$("#frmdatos").submit();
});
});
</script>
</head>

...

(2)Junto a la tabla tengo el link para exportar a exel

<div style="float:right; width:35px;">
<a href="pagina_principal_excel.php"><img name="botonExcel" src="../../images/to_exel.png" /></a>
</div>

...

(3)Formulario para enviar datos

<form action="ficheroExcel.php" method="post" target="_blank" id="frmdatos">
<input type="hidden" id="datos_a_enviar" name="datos_a_enviar" />
</form>

</body>
</html>


Pagina_principal_excel.php

...

(1)
<head>
<script language="javascript">
$(document).ready(function() {
$("#datos_a_enviar").val( $("<div>").append( $("#resumen").eq(0).clone()).html());
$("#frmdatos").submit();
document.location = 'ee_electsen_lect.php?sub=<?php echo $_GET['sub']; ?>';
});
</script>
</head>

...

(2)
<body>
<table id="resumen" width="530" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>AQUI DEBE IR LA ECUACION A MOSTRAR EN EXCEL</td>
</tr>
</table>

...

(3)
<form action="ficheroExcel.php" method="post" target="_blank" id="frmdatos">
<input type="hidden" id="datos_a_enviar" name="datos_a_enviar" />
</form>

</body>


ficheroExcel.php

<?php
header("Content-type: application/vnd.ms-excel; name='excel';");
header("Content-Disposition: filename=ficheroExcel.xls");
header("Pragma: no-cache");
header("Expires: 0");

echo stripslashes(utf8_decode($_POST['datos_a_enviar']));

?>