views:

1116

answers:

5

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)

A: 

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

Chris Lively
Can you point me to details of Excel version where this problem has been fixed (knowledge base articles etc.)?
Matthew Murdoch
A: 

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.

Jas Panesar
Yes. It is reproducible in my environment. Chris Lively suggested that it is a known issue.
Matthew Murdoch
+1  A: 

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).

Matthew Murdoch
A: 

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.

rwmnau
This is a problem I'm seeing in development. It is not restricted to my machine, however, being reproducible on at least one other development box.Although the link is for multiple monitors it is the 'launching a new Excel process' part of it which may solve the issue. I've not tried this yet...
Matthew Murdoch
The instructions for launching a new process is something that has to be done on the client computer, though, which is out of your control since you have a web app with no installer. Are these machines you have control of, such that you could change that setting if you needed to?
rwmnau
Currently the problem is manifesting on a development box. However, the software will eventually be deployed on client machines (rather than hosted). If there is no other solution, though, I can at least document the setting in a 'troubleshooting guide' (particularly if it is Excel version specific)
Matthew Murdoch
+1  A: 

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(); 

Robert Vuković
The server-side code is Java, but I'll take a look to see if there is anything obvious around not flushing or closing streams. Thanks.
Matthew Murdoch
The 'Content-Disposition' header prevents Excel from hanging (but see my answer).
Matthew Murdoch