Question

I have a web application which provides Excel files via IE 7. It requests the files with an HTTP GET from a URL which returns the data with a content type of 'application/vnd.ms-excel'. It then opens the spreadsheets in an IFrame.

This all works fine unless Excel is already open when a spreadsheet is downloaded. In this case it is still displayed correctly but reuses the instance of Excel which is open. When the IFrame is closed, Excel hangs. Excel only becomes unlocked if the user logs out of the web application or if they download a file of a different type.

I've tried turning on the 'Ignore other applications' setting under Tools | Options | General but it didn't solve the problem.

I've also tried following the steps in this answer (as the linked reference says 'This issue has been addressed in Excel 2007 beta 2.') with no luck.

Is there some kind of 'disposal' step which I'm not currently doing which would prevent Excel from hanging?

Versions:

Excel 2003 (11.8220.8221) SP3

IE 7.0.5730.11 (Update Versions: 0)

Was it helpful?

Solution 2

Further to Robert's answer, the following line of (Java) code fixes this problem, in that it prevents Excel from hanging:

response.setHeader("Content-Disposition", 
    "attachment; filename=\"" + filename + "\"");

[NB 'response' is an HttpServletResponse]

However, it forces the spreadsheet to be loaded into an Excel window rather than being displayed in the IFrame...

Update: Resetting the URL of the IFrame to blank forces the Excel instance to be disposed and fixes this problem (without requiring the Content-Disposition change).

OTHER TIPS

Not sure if this helps but ...

I had some similar problem (generating CSV content on the fly) long time ago and all I can remember is that it had to do something with right Response methods being called. The code was something like this


Response.Clear();
Response.Buffer = true;

Response.AppendHeader("Content-Disposition", "attachment; filename=export.csv");
Response.Cache.SetCacheability(HttpCacheability.Private);
Response.Cache.SetExpires(DateTime.MinValue);
Response.Cache.SetLastModified(DateTime.Now);
Response.Cache.SetMaxAge(new TimeSpan(1));
Response.ContentType = "text/csv";

Response.ContentEncoding = System.Text.Encoding.Unicode;

...
//Some  writing to the Response.OutputStream
...

Response.Flush();

//I am not sure about the following line:
Response.End(); 

Unfortunately, this is completely out of your hands. It really depends on what version of excel they have and what updates have been applied.

Have you been able to reproduce this issue in your own environment? If not, it may be an issue on the client's computer. Is there any way you can find out what options were or werent installed, or if Excel has been maintained with it's patches?

It seems to me that office itself needs to be re-installed, if not IE 7 after that.

I would also look into any iFrame closing issues. To test this theory out, you could post the iframe to a new page (without iframes) and then link back to a page with iframes and the excel file? I realize that probably wont' be a working solution for you, but it should help you eliminate whether it's excel, IE7 or the iframe code having a bug.

Is this something you're able to reproduce, or is it something being reported to you by a customer, and you're trying to hunt it down?

The link you've provided deals with multiple monitors - I have multiple monitors as well when I dock my laptop, and I've found a number of applications don't respond well. For example, if an application attempts to open a modal dialog box in a desktop space that doesn't exist anymore (for example, on my "second monitor" after I'veundocked my laptop), it will lock up the application since I can't get to the box. Could that be what's happening here?

Another potential problem happens if you're asking the user for some kind of authentication when they get the Excel file. On our sharepoint site, Excel wants the user to authenticate, and if that modal authentication dialog somehow gets pushed into the background, it can be impossible to get to the front again. The only way is if you kill the process or if you close the sharepoint browser, since that terminates the request for the file in the first place.

Hope this helps, and if either of these give you some more clues, post them here and we'll get this solved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top