Salve,
per creare un file excel da asp uso il seguente codice:
Response.Buffer = true
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "content-disposition", "attachment; filename=mFile.xls"
sb = ""
sb = sb & "<html xmlns
='urn:schemas-microsoft-com
ffice
ffice'"
sb = sb & " xmlns:x='urn:schemas-microsoft-com
ffice:excel' "
sb = sb & "xmlns=http://www.w3.org/TR/REC-html40><head>"
sb = sb & "<meta http-equiv=Content-Type content='text/html; charset=windows-1252'>"
sb = sb & "<meta name=ProgId content=Excel.Sheet>"
sb = sb & "<meta name=Generator content='Microsoft Excel 9'>"
sb = sb & "<!--[if gte mso 9]>"
sb = sb & "<xml><x:ExcelWorkbook><x:ExcelWorksheets>"
sb = sb & "<x:ExcelWorksheet><x:Name>" & mFoglio1 & "</x:Name>"
sb = sb & "<x:WorksheetOptions>"
sb = sb & "<x:Selected/><x
rotectContents>False</x
rotectContents>"
sb = sb & "<x
rotectObjects>False</x
rotectObjects>"
sb = sb & "<x
rotectScenarios>False</x
rotectScenarios>"
sb = sb & "</x:WorksheetOptions>"
sb = sb & "</x:WorksheetOptions>"
sb = sb & "</x:ExcelWorksheet> "
sb = sb & "</x:ExcelWorksheets>"
sb = sb & "<x
rotectStructure>False</x
rotectStructure>"
sb = sb & "<x
rotectWindows>False</x
rotectWindows></x:ExcelWorkbook></xml>"
sb = sb & "<![endif]--></head><body>"
sb = sb & "<table border =1>"
for i = 0 To 19
sb = sb & "<tr>"
for x = 0 to 15
sb = sb & "<td> AA" & i & x & "</td>"
next
sb = sb & "</tr>"
next
sb = sb & "</table></body>"
sb = sb & "</body></html>"
Response.Write sb
Response.Flush
Response.End
Mi funziona bene, il mio problema è che vorrei creare degli altri fogli lavoro ma non ci riesco.
Grazie.
per creare un file excel da asp uso il seguente codice:
Response.Buffer = true
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "content-disposition", "attachment; filename=mFile.xls"
sb = ""
sb = sb & "<html xmlns



sb = sb & " xmlns:x='urn:schemas-microsoft-com

sb = sb & "xmlns=http://www.w3.org/TR/REC-html40><head>"
sb = sb & "<meta http-equiv=Content-Type content='text/html; charset=windows-1252'>"
sb = sb & "<meta name=ProgId content=Excel.Sheet>"
sb = sb & "<meta name=Generator content='Microsoft Excel 9'>"
sb = sb & "<!--[if gte mso 9]>"
sb = sb & "<xml><x:ExcelWorkbook><x:ExcelWorksheets>"
sb = sb & "<x:ExcelWorksheet><x:Name>" & mFoglio1 & "</x:Name>"
sb = sb & "<x:WorksheetOptions>"
sb = sb & "<x:Selected/><x


sb = sb & "<x


sb = sb & "<x


sb = sb & "</x:WorksheetOptions>"
sb = sb & "</x:WorksheetOptions>"
sb = sb & "</x:ExcelWorksheet> "
sb = sb & "</x:ExcelWorksheets>"
sb = sb & "<x


sb = sb & "<x


sb = sb & "<![endif]--></head><body>"
sb = sb & "<table border =1>"
for i = 0 To 19
sb = sb & "<tr>"
for x = 0 to 15
sb = sb & "<td> AA" & i & x & "</td>"
next
sb = sb & "</tr>"
next
sb = sb & "</table></body>"
sb = sb & "</body></html>"
Response.Write sb
Response.Flush
Response.End
Mi funziona bene, il mio problema è che vorrei creare degli altri fogli lavoro ma non ci riesco.
Grazie.
Ultima modifica: