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 

How to export the reports into excel.

Hello Everyone,


Actually, am designing reports on visualforce page, not using Standard reports of salesforce. i want to implement button name Export to Excel. am not getting anything to implement the same. If anyone know the coding for export button pls post the code.


Pls help me for the same.



Thanks In Advance



Hello Everybody,


Am also facing the problem in export the data of visual force page into excel. I have implement the code and report is successfully exported but in the exported report i.e. in excel sheet its showing the week days in the end also calender months and Year in the form of picklist.


Can anyone suggest me solution for the same?


Thanks In Advance



I have the same issue. worked OK before, but now VF seems to render a calender picklist into the Excel (see image below).

<div class ="datePicker"> with all monthes and years defined is added at the bottom of the page ... I don't have any datefield on the page at all!


Any ideas?




januari februari maart april mei juni juli augustus september oktober november december 2010 2011 2012 2013 2014 2015 2016


Hi MarceldeB


Did you get any solution for this problem??





The most important is to set standardstylesheets=false in the page tag.


But in fact most attributes should be switched off. So now I usually set a variable in the class which I check in the page:


in the extension or controller:


  public string Contenttype {get; set;}
  public pagereference Excel(){
    contenttype = 'application/';
    return null;


in the page:

<apex:page title="myPage" controller="myPageCon"
  contenttype="{!contenttype}" cache="true" showheader="{!contenttype==''}" sidebar="{!contenttype==''}" standardstylesheets="{!contenttype==''}">

and to get the pageblock header properly:

<apex:pageblock title="{!IF(contenttype=='','myPageBlockTitle','')}">



Hi MarceldeB


I added 'standardstylesheets=false' to my apex:page. Now its exporting fine without the calender.


But since there is no standardstylesheet, I am not getting my calander in textbox focus?


Shall I write seperate code for datepicker?





My problem solved Thanks :)