Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I have the following code which generates an Excel document on the fly. I then want to take the file and let the user decide to save it or open it.

 

Dim xls As New ExcelFile
Dim fileName As String = xls.Generate()
Dim file As New IO.FileInfo(fileName)
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name)
Response.AddHeader("Content-Length", file.Length.ToString())
Response.ContentType = "application/excel"
Response.WriteFile(file.FullName)
Response.End()

 

When it runs I get the egg timer for a few seconds, then the error message icon in the bottom left of the browser appears.

 

The message is.

 

The data nessessary to complete the operation is not yet available

 

Any help appreciated?

 

Thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...