Visualforce Export to Excel / IE Bug

December 29th, 2008

There is a very nice article on how to export data to Excel using Visualforce. The only problem is that there is a known issue when using Internet Explorer that prevents it from working correctly.

Here is the workaround and I have asked our support rep to check on the status of the bug.

1
2
3
4
5
6
7
8
9
 
<apex:page controller="YOURCONTROLLER" contentType="application/vnd.ms-excel#FILENAME.xls" cache="true">
	<apex:pageBlock title="Export Results" >
		<apex:pageBlockTable value="{!results}" var="c">
			<apex:column value="{!c.FirstName}"/>
			<apex:column value="{!c.LastName}"/>
		</apex:pageBlockTable>
	</apex:pageBlock>
</apex:page>

Categories: Salesforce, Visualforce

Leave a comment

Comments Feed4 Comments

  1. Asish

    I am trying to export a VFP which contains a “Custom controller”. This controller includes images also. The images is especially to show the hierarchy of User.But the excel is not exporting properly.

    Could you please suggest any solutions!

    Thanks in advance

  2. Santhosh

    I am facing the same problem here. Its a custom page with custom controller. Exports all the buttons, links everything on the page. Is there a way to just capture the data and export this into excel?

  3. joe

    This does not work for me. in Firefox, I get a error indicating that the file format is different than expected. I say yes the file is not corrupt and everthing is fine. In IE, its a hard error. the file will not load

  4. Jeff Douglas

    @Santhosh, What about writing it to a file and attaching it to the record itself?

Leave a comment

Feed

http://blog.jeffdouglas.com / Visualforce Export to Excel / IE Bug

WordPress Appliance - Powered by TurnKey Linux