Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/04/2006, 13:55
Avatar de a n g e l u s
a n g e l u s
 
Fecha de Ingreso: enero-2006
Ubicación: Chile
Mensajes: 237
Antigüedad: 18 años, 4 meses
Puntos: 1
Solucion Para Exportar A Excel/word/pdf

HOLA AQUI DEJO UN CODIGO PARA EXPORTAR A EXCEL/WORD/PDF SEGUN LA OPCION QUE ENVIEN, ESPERO LES SIRVA

<html>
<head>
<title>EXPORTAR A DOCUMENTO</title>
<%
sub exportarexcel()
Response.buffer = true
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "filename=respaldo.xls;"
end sub

sub exportarword()
Response.buffer = true
Response.ContentType = "application/vnd.ms-word"
Response.AddHeader "Content-Disposition", "filename=respaldo.doc;"
end sub

sub exportarpdf()
Response.AddHeader "Content-Disposition", "attachment;filename=respaldo.pdf;"
Response.ContentType = "application/pdf"
response.Write(request("tabla"))
' Response.BinaryWrite(request("tabla"))
Response.Flush()
Response.Close
end sub


%>

<script language=javascript >
function cerrar(){

var ventana = window.self;
ventana.opener = window.self;
// ventana.close();
}

/*
while (tabla.search("\"") != -1) {
tabla = tabla.replace("\"","'");
}
*/


</script>

</head>

<body onload=cerrar();>

<%
tabla = request("tabla")
opcion = request("accion")
response.Write(tabla)
' response.Binarywrite(tabla)

if tabla <> "" then
if tabla <> "0" then
if opcion = 1 then 'EXCEL
exportarexcel
end if
if opcion = 2 then 'PDF
exportarpdf
end if
if opcion = 3 then 'WORD
exportarword
end if
end if
end if
%>
</body>
</html>
__________________
Atte,
A n g e l u s
Concepción - Chile
más vale respuestas bien pensadas, que 7000 post