Last active
December 31, 2020 16:55
-
-
Save douglascayers/1b103b1eb6e2dc8c167c8112ef686d36 to your computer and use it in GitHub Desktop.
Visualforce CSV Example. Note the 'contentType' page attribute and the # to specify the file name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
This page must be accessed with an Account ID in the URL. | |
For example: https://<salesforceInstance>/apex/ContactsCsvPage?id=001D000000JRBet | |
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_styling_content_type.htm | |
--> | |
<apex:page standardController='Account' contentType='application/vnd.ms-excel#contacts.xls'> | |
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"contentType='application/vnd.ms-excel#contacts.xls". Excellent! It works! I appreciate your sharing!