+ Start a Discussion

Displaying a page in EXCEL - contenttype="application/vnd.ms-excel"

I am having difficulties attempting to run the Microsoft Excel ContentType example on page 43 of the Visualforce Developers Guide.  Is there anything incorrect in the example as shown in the guide? 
I am able to get satisfactory results using a few other contenttypes, such as (1) text/html, (2) text/plain, and (3) text/richtext, but Internet Explorer 7 cannot open or save the resulting file.
Has anyone any ideas to share about this?  Oh, yeah, I'm a newbie...
Thanks in advance.
There is an IE (6&7) specific issue with certain client headers that causes the "Unable to download" error - this issue has been fixed in the next release (no plans to backport to the dev preview at this time). You should be able to test things using Firefox or Safari.
Thank you, Doug. Using either Firefox or Safari, I get the expected behavior. And thank you for your speedy reply.

With Summer 08 release I am witnessing the same problem. It is working fine in Firefox, but not in IE 7. I was just wondering whether it was fixed or not.

Your response is greatly appreciated.

The issue is specific to IE using HTTPS, I was able to successfully download from the demo page using HTTP instead of HTTPS.

Message Edited by dchasman on 06-25-2008 02:59 PM

I tried to run the sample code given in the Visual Force Developer's guide in IE 7 and it didn't work for me. Is there anything i am missing here. I have used 'http' instead of 'https' as mentioned by Doug.

Any help on this is highly appreciated.



As u have mentioned Displaying a page in EXCEL - contenttype="application/vnd.ms-excel" does not work in IE7. Is there any alternative way to achieve this. Iam ready to use SControl if we can not use VisualForce. Because my client uses IE7 only. Please help if you know the solution.
Thanks in advance :) 

No need to use SControl. Plz try follwoing line. Its working in IE 7.

<apex:page cache="true" contentType="application/vnd.ms-excel#TempExcel.xls" controller="ExcelController" language="{!userLanguage}">

Plz do let me know, if this resolves your issue.


Rajesh ShahRajesh Shah
I am having the same problem when opening a pdf page using Visualforce. I tried using cache = true but it still didn't worked. Please tell me if I need to do something more.
This *was* working for me but no longer.  Seems like overnight it stopped--works fine in Firefox, but not in IE 6.

** Resolved with Workaround **
What I had to do was redevelop my pages and create separate controllers between the pages. A bit of a hassle, but writing out the full URL in PageReference, using 'http' vs. 'https', and passing in all of my parameters in the URL did the trick.  I'm not sure why this was working before in IE and then suddenly stopped, but my app is working again and ready to move on.

Message Edited by mcrosby on 11-11-2008 09:55 AM
Rajesh ShahRajesh Shah
I solved it in a different way. I had a command link which was calling the visualforce page that generated the pdf. The URL earlier was constructed dynamically. After it stopped working, I changed the code and generated a page reference to that Visualforce page instead of URL. I passed this page reference to the Command Link  and it worked.
So now I don't need to worry about changing https to http. :)
Ron WildRon Wild
Is there an "official" workaround for this IE7 contenttype download problem?    I've tried several variations will no luck ...  different mime types (text/csv, text/rtf, application/vnd.ms-excel) , cache="true", etc.    IE7 still fumbles the ball when downloading my cvs content.

Building and returning an http:// page reference just makes IE open a new browser and prompt for a salesforce login.

<apex:page controller="MassEmailContactsController" cache="true" showHeader="false" contentType="text/csv#contacts.csv">
<apex:repeat value="{!selectedContacts}" var="contact">

 I'd love to just tell the customer to avoid IE7, but they don't see that as an option.


Message Edited by Ron Wild on 12-02-2008 01:06 PM

Thanks a bunch... this resolved the issue.

Gsekar DuraiGsekar Durai

CAn you post your code how you resolved IE issue??