function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
chirugantachiruganta 

Need help on showing visualforce page as excel.

Hi,

I need help on showing visualforce page as excel I tried it using contenttype="application/vnd.ms-excel. But when I opened it, it will download as excel file automatically. I need view instead of download page. Please someone help me on this. 
Pavan DavePavan Dave
You may try this in your VF page:

<a target="_blank" href="https://c.ap1.content.force.com/servlet/servlet.FileDownload?file=XXXXXXXXXXXXXXX" onclick="return windowpop(this.href, 545, 433)"> Preview File </a>
Ken KoellnerKen Koellner
Won't that pull a File that's stored in a File sObject?  Doesn't the question ask to return the VF page?

I use--
<apex:page controller="xxx" contenttype="application/x-excel#myFileName.xls" showheader="false">

	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	</head>
	
Page contents go here.  I usually one simple HTML table with <table><tr><td> tags generated with apex repeats.

</apex:page>