Hi , apex: public class Accountrecs { private Apexpages.StandardController controller;
public Accountrecs(Apexpages.StandardController controller){ this.controller=controller; } public List<Account> getAccounts(){ return[select id,name,CreatedDate,phone from Account ORDER BY CreatedDate DESC]; } }
Can you check below similar example.
https://developer.salesforce.com/forums/?id=906F00000009FK9IAM
Please mark as Best Answer if above information was helpful.
Thanks,
apex:
public class Accountrecs {
private Apexpages.StandardController controller;
public Accountrecs(Apexpages.StandardController controller){
this.controller=controller;
}
public List<Account> getAccounts(){
return[select id,name,CreatedDate,phone from Account ORDER BY CreatedDate DESC];
}
}
vf:
<apex:page standardController="Account" renderAs="PDF" standardStylesheets="false" extensions="Accountrecs">
<apex:form >
<apex:pageBlock >
<apex:pageBlocksection >
<apex:pageBlockSectionItem >
<apex:pageBlockTable value="{!accounts}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.phone}"/>
<apex:column value="{!a.createdDate}"/>
</apex:pageBlockTable>
</apex:pageBlockSectionItem>
</apex:pageBlocksection>
</apex:pageBlock>
</apex:form>
</apex:page>
I hope this helps.
Thank you..