Using ASP.NET with Excel Files

5uX

New Member
I want to create an excel file from a web page in ASP.NET, I'm using the Microsoft.Office.Interop.Excel library, but I can't delete the file create on the side of the server, because I get in trouble with the times. I want to know if there is a way to create an Excel file with data of a database for example, and then that the client can download that file without saturate the server.Actually I'm using this code in VB after the file is create in the server, but it doesn't work like I want:\[code\]Dim p As Process = New Process() p.StartInfo = New ProcessStartInfo() p.StartInfo.UseShellExecute = True p.StartInfo.FileName = "taskkill.exe" p.StartInfo.Arguments = "/F /IM EXCEL.exe" p.Start() p.WaitForExit() Thread.Sleep(24) Response.ContentType = "application/vnd.ms-excel" Response.AppendHeader("Content-Disposition", "attachment; filename=Reporte.xlsx") Response.TransmitFile(Server.MapPath("~/Resources/" & HiddenField1.Value.ToString() & ".xlsx")) 'Thread.Sleep(10000) 'Dim fso, f2 'fso = CreateObject("Scripting.FileSystemObject") 'f2 = fso.GetFile(Server.MapPath("~/Resources/" & HiddenField1.Value.ToString() & ".xlsx")) 'f2.Delete() 'Thread.Sleep(24) Response.End()\[/code\]Thanks
 
Back
Top