Comunidad de diseño web y desarrollo en internet online

Encoding Excel

Citar            
MensajeEscrito el 05 Oct 2007 03:16 pm
Hola muchachos, tengo una gran problema, poseo un codigo que me encontré en otro foro de como exportar de un DataGrid de Flex a un archivo de Exel.

La clase en as es:

Código :

 
public function loadDGInExcel(dg:DataGrid):void {
   //Pass the htmltable in a variable so that it can be delivered
   //to the backend script
   var variables:URLVariables = new URLVariables(); 
   variables.htmltable   = DataGrid2Excel.convertDGToHTMLTable(dg);
   //Setup a new request and make sure that we are 
   //sending the data through a post
   var u:URLRequest = new URLRequest(urlExcelExport);
   u.data = variables; //Pass the variables
   u.method = URLRequestMethod.POST; //Don't forget that we need to send as POST
   //Navigate to the script
   //We can use _self here, since the script will through a filedownload header
   //which results in offering a download to the user (and still remaining in you Flex app.)
        navigateToURL(u,"_blank");
}  

y en php es:

Código :

<?php
header("Content-Type: application/xhtml+xml; charset=utf-8");
/**
 * Gracias al Content-disposition, conseguimos que el navegador nos muestre el diálogo de Guardar...
 * Sería sencillo incorporar en el POST a este script un parámetro adicional para indicar el nombre del fichero
 * deseado para nuestro .XLS.
 * 
 * Francisco Rodríguez Cala
 * http://www.meetworks.com
 * http://www.presenciaeninternet.es
 *
 * Export data, delivered in the POST, to excel.
 * 
 * @author S.Radovanovic
 * @version $Id$
 */
header('ETag: etagforie7download'); //IE7 requires this header
header('Content-type: application/octet_stream');
header('Content-disposition: attachment; filename="Datos.xls"');
 
//Add html tags, so that excel can interpret it
echo "<html>
<body>
".stripslashes($_POST["htmltable"])."
</body>
</html>
";

El problema es que cuando me pasa los archivos a Excel, no me funciona el encoding, me sale basura en vez de una tilde o algo asi, quiero que me ayuden haber cual utilizo o como hago para q me funcione, ya probé casi todos los encoding y nada.

porfa les recomiendo

gracias

Por mralejo1

9 de clabLevel



 

firefox
Citar            
MensajeEscrito el 05 Oct 2007 07:05 pm
¿Qué es DataGrid2Excel en tu código de AS3?

Por Freddie

BOFH

53 tutoriales
597 articulos
43 ejemplos

Genero:Masculino   Admin

Conserje de Cristalab

firefox
Citar            
MensajeEscrito el 05 Oct 2007 08:02 pm
DataGrid2Excel es el nombre de la clase donde se encuentra la funcion loadDGInExcel

Por mralejo1

9 de clabLevel



 

firefox
Citar            
MensajeEscrito el 12 Mar 2008 06:02 pm
hola !!! cambiale la siguiente linea:

Código :

header("Content-Type: application/xhtml+xml; charset=utf-8");



por:

Código :

header("Content-Type: application/xhtml+xml; charset=ISO-8859-1");


y asunto solucionado con las tildes!!! espero te sirva

Por tetito

1 de clabLevel



Genero:Masculino  

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.