Salesforce Guides By Talha

To show view the records in a CSV file we can use the following code:

<apex:page standardController="Account" contenttype="application/vnd.ms-excel">
 <apex:pageBlock title="Contacts">
  <apex:pageBlockTable value="{!account.Contacts}" var="contact">
   <apex:column value="{!contact.Name}"/>
    <apex:column value="{!contact.MailingCity}"/>
   <apex:column value="{!contact.Phone}"/>
  </apex:pageBlockTable>
 </apex:pageBlock>
</apex:page>

View original post