I have read the blog Render VFP in EXCEL and I was able to partially achieve my requirement. I Have a wrapper class with say 3 variables. Now when the page is rendered as Excel, results are coming as expected . 3 Variables so 3 Columns got created in excel. But I need to give Customized names for the columns that are created in excel. How can I achieve that. As of now column name is coming as blank. pls suggest.

public class sample{
  public String var1{get;set;}
  public String var2{get;set;}
  public String var3{get;set;}

<apex:page controller="SampleController" contentType="application/vnd.ms-excel#SampleFIleName.xls" cache="true">
        <apex:pageBlockTable value="{!reportExcel}" var="rep">
          Name : <apex:column value="{!rep.var1}"/>  
           <apex:column value="{!rep.var2}"/> 
            <apex:column value="{!rep.var3}"/>

<apex:column> components can have their headers specified with the headerValue attribute, or by including an <apex:facet> within the element:

<apex:column value="{!rep.var1}" headerValue="Column Name" />  


<apex:column value="{!rep.var1}">
    <apex:facet name="header">
        Column Name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.