• Jim Mottola
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Muddling my way through my first visual force page; not a developer by trade.  I've created a visual force button that will output the content of a related list to my opportunities (Visit Report) to a PDF file so that people can easily scroll through all VR's associated with an Opportunity & share with non-SF users.  My code is listed below.  

I have everything working as I like except the following 2 elements which I'm not sure how to handle (hoping for some help):

1) I want to sort the output Descending by the report date field
2) I want to make the headers of the table appear at the top of each page (repeating headers)

Can anybody help with this?  It seems simple but I'm getting lost in the details.
 
<apex:page standardController="Opportunity" renderAs="PDF">
<head>
<style>
@page { size:landscape;}
.headerRow .TableTitle {
            background-color: #139cd8 !important;
            cellPadding="5";}
            body {font-family: 'Arial Unicode MS'; font-size:12px}


 </style></head>
 <apex:image id="logo1" url="/servlet/servlet.ImageServer?id=015i0000002XNDw&oid=00D630000009OtH&lastMod=1394633629000" width="25%" height="25%"/>
 <br/>
 <apex:pageBlock >

        <apex:pageBlockTable value="{!Opportunity.Visit_reports__r}" var="item" cellpadding="5" columnsWidth="5%,5%,5%,10%,65%" border="1">
            <apex:column style="vertical-align:top; text-align:center" headerValue="Name" headerClass="TableTitle" value="{!item.Name}"/>
            <apex:column style="vertical-align:top; text-align:center" headerValue="Account" headerClass="TableTitle" value="{!item.Account__c}"/>
            <apex:column style="vertical-align:top; text-align:center" headerValue="Report Date" headerClass="TableTitle" value="{!item.Report_Date__c}"/>
            <apex:column style="vertical-align:top; text-align:left" headerValue="Purpose of Visit" headerClass="TableTitle" value="{!item.Purpose_of_Visit__c}"/>
            <apex:column style="vertical-align:top; text-align:left" headerValue="Visit Details" headerClass="TableTitle" value="{!item.Visit_Details__c}"/>
        </apex:pageBlockTable> 
        </apex:pageBlock>
</apex:page>