Ver Mensaje Individual
  #18 (permalink)  
Antiguo 25/11/2008, 07:55
Avatar de JuanRAPerez
JuanRAPerez
Colaborador
 
Fecha de Ingreso: octubre-2003
Mensajes: 2.393
Antigüedad: 21 años, 6 meses
Puntos: 27
Respuesta: como exportar tablas a excel desde una pagina creada en ASP

úsalo así:

sin usar JS
ni nada de nada mas que esto

tu pagina de enlace
Código asp:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
  5. <title>Untitled 2</title>
  6. </head>
  7. <body>
  8.           <p><a href="exportar.asp" target="_blank">exportar.asp</a></p>
  9. </body>
  10. </html>

tu pagina asp llamada exportar.asp
Código asp:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
  5. <title>Untitled 1</title>
  6. </head>
  7. <body>
  8.           <%
  9.           response.write "<table>"
  10.           response.write "<tr><td>hola mundo X1</td>"
  11.           response.write "<td>hola mundo X1</td>"
  12.           response.write "<td>hola mundo X1</td></tr>"
  13.           response.write "</table>"
  14.           Response.ContentType = "application/vnd.ms-excel"
  15.           Response.AddHeader "content-disposition", "attachment; filename=Consulta.xls"
  16.           %>
  17. </body>
  18. </html>

suerte
__________________
JuanRa Pérez
San Salvador, El Salvador