Visualforce to Excel


/ Published in: Other
Save to your folder(s)

Credits to Sati Hillyer & Jeff Douglas


Copy this code and paste it in your HTML
  1. <apex:page standardController="Account" contentType="application/vnd.ms-excel#FILENAME.xls" cache="true">
  2. <apex:pageBlock title="Hello {!$User.FirstName}!">
  3. You are viewing the {!account.name} account.
  4. </apex:pageBlock>
  5. <apex:pageBlock title="Contacts">
  6. <apex:pageBlockTable value="{!account.Contacts}" var="contact">
  7. <apex:column value="{!contact.Name}"/>
  8. <apex:column value="{!contact.Email}"/>
  9. <apex:column value="{!contact.Phone}"/>
  10. </apex:pageBlockTable>
  11. </apex:pageBlock>
  12. </apex:page>

URL: http://blog.sforce.com/sforce/2008/12/visualforce-to-excel.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.