You need to sign in to do that
Don't have an account?
Subramani_SFDC
Need help for Export to excel in vf
I have vf page...I have run report button to display the records and also filtering by dates...I want export the result into excel,pdf,csv files through command button...Any one help regarding this welcome.....Thanks in advance....
Hi Subra,
If you are on the report page it would already have the "Export Details" button.
If you are looking at a list of records of an object then see the snippets below which might help,
http://blogs.developerforce.com/systems-integrator/2008/12/visualforce-to-excel.html
http://boards.developerforce.com/t5/Visualforce-Development/Export-records-to-Excel-with-Visualforce/td-p/202293
http://blog.tquila.com/2012/03/03/export-to-excel-functionality-using-the-wizard-technique/
Hi Subra ,
You can do the following code :
VF page :
<apex:commandButton value="Export to Excel" action="{!FetchExcelReport}" id="theButton" style="height:30px;width:120px"/>
Controller :
public Pagereference FetchExcelReport()
{
PageReference nextpage = new PageReference('/apex/ExcelReportPage');
return nextpage;
}
What you have to do is:
1.Create copy of existing page .(Suppose ur Vf page is VfReportPage and same page with Name ExcelReportPage)
2.Add <apex:page contentType="application/vnd.ms-excel#ExcelReportPage.xls" controller="controllerName"> in the ExcelReportPage.
So that you can get same vf page in the excel format .
Thanks