avendo excell installato nel server
puoi creare e salvare su disco un file xls così
codice:
<%
Dim ExcelApp
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Application.Visible = True
Set ExcelBook = ExcelApp.Workbooks.Add
ExcelBook.Worksheets(1).Cells(2, 2).Font.Name = "Verdana"
ExcelBook.Worksheets(1).Cells(2, 2).Font.Size = 10
ExcelBook.Worksheets(1).Cells(2, 2).Font.Italic = true
ExcelBook.Worksheets(1).Cells(2, 2).Value="Hello world"
ExcelBook.Worksheets(1).Cells(2, 2).HorizontalAlignment = 1
ExcelBook.Worksheets(1).Cells(2, 2).Font.Color = RGB(0,0,0)
ExcelBook.SaveAs "c:\yourfile.xls"
ExcelApp.Application.Quit
Set ExcelApp = Nothing
%>
se invece vuoi fare una pagina asp che restituisce un file xls (senza avere excell installato)
codice:
<%
Dim FileName
FileName="test.xls"
response.buffer = true
response.ContentType = "application/vnd.ms-excel"
response.AddHeader "content-disposition", "inline; filename=" & FileName
response.write "<table border=1>"
response.write "<tr>"
for i = 1 to 15 step 3
response.write "<td>"
response.write i * i
response.write "</td>"
next
response.write "<td width=40>=SOMMA(A1:E1)</td>"
response.write "</tr>"
response.write "</table>"
response.flush
response.end
%>