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

