function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Click download button on account object the data will down load excet format in detail page data

Hi Account object is there one button is creted called download click that button account detail page data converted into excel format pls give that code And kindely share that one




You can create a text file by following way (I am doing this stuff on Account object, you can use for your object) -


1. Create visualforce page with standard controller = Account (choose on which object you want Download button)


Name of VF page : DownloadAccount:-


<apex:page contentType="text/plain/#account.txt" cache="false" standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
   <apex:repeat var="a" value="{!accounts}">


2. Create a custom button for listl page name Download-

     1.1 Goto setup-->Account--> Button and Links--> New Button--> Display Type = List Button and Content Source = visualforce page(DownloadAccount)

 3. Go to search layout and set visible to this Download button on list view page of Account.

4. On Account Detail Page create a view and select it. This view will act as filter to retrieve the record in text file. If selected view have 0 records then text file have also 0 records, so use View carefully.


Click on Download button, it will automatically download your all records in account.text file

Hi subra Thanks for giving this one ok what iam asking kindely give that full code apex and controlle class .

i have created one record go for the detail page that page level click once the whole detail page data will converted in one excel format