• mulukutla pavani
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
hai in my visual force page three buttons are there pdf,word,excel.when ever click on pdf the page is render as pdf,click on word that same page will be download as word file,click on excel excel file will be downloaded for that i wrote a code like this 


<apex:page standardController="account" recordSetVar="account" renderAs="{!if($CurrentPage.parameters.isPdf == null, null, 'pdf')}" contentType="{!if($CurrentPage.parameters.isWord== null, null,'application/x-excel#FileName.doc')}" extensions="pwe">
<apex:form >
<apex:pageBlock >
<apex:pageblockButtons >
<apex:commandButton value="pdf" action="/apex/automatic_insert?isPdf=true"/>
<apex:commandButton value="word" action="/apex/automatic_insert?isWord=ture"/>
<apex:commandButton value="excel" action="{/apex/automatic_insert?isExcel=ture"/>
</apex:pageblockbuttons>
<apex:pageBlockTable value="{!account}" var="a">
  <apex:column value="{!a.name}"/>
  <apex:commandButton action="{!save}" value="save"/>
  </apex:pageBlockTable>
  </apex:pageBlock>
</apex:form>
</apex:page>
 

but i am getting confusion with contentType.in <apex:page> we can place any one contentType.when how can i get excel with this code please help me ony one