You need to sign in to do that
Don't have an account?
srilakshmi1.387861669756762E12
click on a button visual force page will be download as a excel file
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
<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
contentType="application/vnd.ms-excel#PartnerDealReg.xls"
or
contentType="text/csv#U65_{!dtdisplay}.csv
<apex:page standardController="account" recordSetVar="account" renderAs="{!if($CurrentPage.parameters.isPdf == null, null, 'pdf')}" contentType="{!if($CurrentPage.parameters.isWord == null, if($CurrentPage.parameters.isExcel == null, null ,'application/vnd.ms-excel#fileName.xls'),'application/x-excel#FileName.doc')}" >
Mark this as Solved if it resolves your query.