Necesito generar con ASP un archivo excel con mult
Publicado por luis jara (1 intervención) el 07/09/2006 16:14:45
Necesito generar con ASP un archivo excel con multiples hojas, hasta el momento genero el archivo excel con multiples hojas pero sólo genero datos en una sóla hoja. ¿Cómo puede generar datos en todas las hojas?
Tengo el siguiente código:
<%
sFileName = "temporary.xls"
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "filename=" & sFileName
Dim sSpreadsheet
sSpreadsheet = "Interago export"
Response.Write "<html xmlns:x=""urn:schemas-microsoft-com:office:excel"">"
Response.Write "<head>"
Response.Write "<!--[if gte mso 9]><xml>"
Response.Write "<x:ExcelWorkbook>"
' Primera Hoja
Response.Write "<x:ExcelWorksheets>"
Response.Write "<x:ExcelWorksheet>"
Response.Write "<x:Name>" & sSpreadsheet & "1</x:Name>"
Response.Write "<x:WorksheetOptions>"
Response.Write "<x:Print>"
Response.Write "<x:ValidPrinterInfo/>"
Response.Write "</x:Print>"
Response.Write "</x:WorksheetOptions>"
Response.Write "</x:ExcelWorksheet>"
' Segunda Hoja
Dim sSsheet
sSsheet = "excel3.htm"
Response.Write "<x:ExcelWorksheet>"
Response.Write "<x:Name>" & sSpreadsheet & "2</x:Name>" Response.write "<x:WorksheetSource HRef=" & sSsheet & "/>"
Response.Write "<x:WorksheetOptions>"
Response.Write "<x:Print>"
Response.Write "<x:ValidPrinterInfo/>"
Response.Write "</x:Print>"
Response.Write "</x:WorksheetOptions>"
Response.Write "</x:ExcelWorksheet>"
' Tercera hoja
sSsheet = "excel4.htm"
Response.Write "<x:ExcelWorksheet>"
Response.Write "<x:Name>" & sSpreadsheet & "3</x:Name>"
Response.write "<x:WorksheetSource HRef=" & sSsheet & "/>"
Response.Write "<x:WorksheetOptions>"
Response.Write "<x:Print>"
Response.Write "<x:ValidPrinterInfo/>"
Response.Write "</x:Print>"
Response.Write "</x:WorksheetOptions>"
Response.Write "</x:ExcelWorksheet>"
Response.Write "</x:ExcelWorksheets>"
Response.Write "</x:ExcelWorkbook>"
Response.Write "</xml>"
Response.Write "<![endif]--> "
response.write "<style>"
response.write ".textclass{mso-number-format:\@;}"
response.write "</style>"
Response.Write "</head>"
Response.Write "<body>"
sPrint = "<table>"
For I=1 TO 10
sPrint = sPrint & "<tr>"
sPrint = sPrint & "<td><strong>jara " & I & "</strong></td>"
sPrint = sPrint & "</tr>"
Next
sPrint = "</table>"
response.write "</body></html>"
%>
Tengo el siguiente código:
<%
sFileName = "temporary.xls"
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "filename=" & sFileName
Dim sSpreadsheet
sSpreadsheet = "Interago export"
Response.Write "<html xmlns:x=""urn:schemas-microsoft-com:office:excel"">"
Response.Write "<head>"
Response.Write "<!--[if gte mso 9]><xml>"
Response.Write "<x:ExcelWorkbook>"
' Primera Hoja
Response.Write "<x:ExcelWorksheets>"
Response.Write "<x:ExcelWorksheet>"
Response.Write "<x:Name>" & sSpreadsheet & "1</x:Name>"
Response.Write "<x:WorksheetOptions>"
Response.Write "<x:Print>"
Response.Write "<x:ValidPrinterInfo/>"
Response.Write "</x:Print>"
Response.Write "</x:WorksheetOptions>"
Response.Write "</x:ExcelWorksheet>"
' Segunda Hoja
Dim sSsheet
sSsheet = "excel3.htm"
Response.Write "<x:ExcelWorksheet>"
Response.Write "<x:Name>" & sSpreadsheet & "2</x:Name>" Response.write "<x:WorksheetSource HRef=" & sSsheet & "/>"
Response.Write "<x:WorksheetOptions>"
Response.Write "<x:Print>"
Response.Write "<x:ValidPrinterInfo/>"
Response.Write "</x:Print>"
Response.Write "</x:WorksheetOptions>"
Response.Write "</x:ExcelWorksheet>"
' Tercera hoja
sSsheet = "excel4.htm"
Response.Write "<x:ExcelWorksheet>"
Response.Write "<x:Name>" & sSpreadsheet & "3</x:Name>"
Response.write "<x:WorksheetSource HRef=" & sSsheet & "/>"
Response.Write "<x:WorksheetOptions>"
Response.Write "<x:Print>"
Response.Write "<x:ValidPrinterInfo/>"
Response.Write "</x:Print>"
Response.Write "</x:WorksheetOptions>"
Response.Write "</x:ExcelWorksheet>"
Response.Write "</x:ExcelWorksheets>"
Response.Write "</x:ExcelWorkbook>"
Response.Write "</xml>"
Response.Write "<![endif]--> "
response.write "<style>"
response.write ".textclass{mso-number-format:\@;}"
response.write "</style>"
Response.Write "</head>"
Response.Write "<body>"
sPrint = "<table>"
For I=1 TO 10
sPrint = sPrint & "<tr>"
sPrint = sPrint & "<td><strong>jara " & I & "</strong></td>"
sPrint = sPrint & "</tr>"
Next
sPrint = "</table>"
response.write "</body></html>"
%>
Valora esta pregunta


0