2

Hi I have created form which has an excel template for users to download and fill, but when i click on download link its getting redirected to another page.I dont know how to proceed and I want to remain on same page and hold the filled information. pls help me out!! The excel headers are in a VF page Template

<apex:outputLink value="{! $Page.Template}" rendered="null"> Download </apex:outputLink> 
<br/><br/>

public ExportToExcel() {
   //Apex Page refference methods from apex can used to redirect from one page to another page.
     public ApexPages.PageReference goToExportPage() {
        return Page.Template;
     } 

<apex:page showHeader="false" controller="ExportToExcel" ContentType="application/vnd.ms-excel#Report.xls" standardstylesheets="false" cache="True" > 
 <apex:panelGrid border="1" cellpadding="5" cellspacing="5"/> 
   <head> 
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> 
    <style type="text/css"> 
       table, th, td { border: .5px solid black; } 
       tr{ border: .5px solid black;} 
    </style> 
  </head> 
  <body>
     <table> 
       <tr> 
        <th filter="all">Unit</th>
  </body>
1
  • Can you share you visualforce page code? Oct 24, 2014 at 19:19

2 Answers 2

2

Use commandLink tag and action attribute to call goToExportPage() method.

<apex:commandLink id="exportlink" action="{!goToExportPage}" value="{!$Page.Template"} />

-2

Visualforce Export Excel Report Using Remote Action and AlaSQL

You can export excel using javascript remoting, For this you don't need to create additional visualforce page to renderAs excel.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .