creazione di worksheet

  • Creatore Discussione Creatore Discussione u13
  • Data di inizio Data di inizio

u13

Nuovo Utente
15 Mar 2010
1
0
0
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:o='urn:schemas-microsoft-com:office:office'"
sb = sb & " xmlns:x='urn:schemas-microsoft-com:office: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:ProtectContents>False</x:ProtectContents>"
sb = sb & "<x:ProtectObjects>False</x:ProtectObjects>"
sb = sb & "<x:ProtectScenarios>False</x:ProtectScenarios>"
sb = sb & "</x:WorksheetOptions>"
sb = sb & "</x:WorksheetOptions>"
sb = sb & "</x:ExcelWorksheet> "
sb = sb & "</x:ExcelWorksheets>"
sb = sb & "<x:ProtectStructure>False</x:ProtectStructure>"
sb = sb & "<x:ProtectWindows>False</x:ProtectWindows></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.
 
Ultima modifica:

Discussioni simili