2

Have a custom List View button which opens a VFP and renders the results as PDF. (easy stuff, standard controller and nothing funky). I would have thought that any sorting applied to the list view would be applied to my opening page. So if I sort on Deal Report Order then my PDF page would be sorted the same way.

Anyone know what I mean? Should it work like that?

Here is the standard List View showing the sorting

enter image description here

I would expect the order on the VFP / PDF to show Account 1, 2, 3 and 4 in that order.

VFP

<apex:page standardController="Account" recordSetVar="accs" showHeader="false" 
  sidebar="false" standardStylesheets="false" renderAs="pdf" 
applyHtmlTag="false" applyBodyTag="false">

then doing this

 <apex:repeat value="{! accs }" var="a">  

Here is the full VFP

<apex:page standardController="Account" recordSetVar="accs" showHeader="false" 
  sidebar="false" standardStylesheets="false" renderAs="pdf" 
applyHtmlTag="false" applyBodyTag="false">

  <apex:stylesheet value="{!$Resource.tables}"/>


<head>


    <style type="text/css">
        @page {
            margin: 1em;
            size: A4 Landscape;



            @bottom-left {
               /* content: "Date {!DAY(TODAY())}.{!MONTH(TODAY())}.{!YEAR(TODAY())}"; */
                font-family: sans-serif;
                font-size: 5px;
            }
            @bottom-right {
                content: "Page " counter(page) " of " counter(pages);
                font-family: sans-serif;
                font-size: 7px;
                font-weight: bold;
            }



        }




  table {

      -fs-table-paginate: paginate;


    }  

  thead {
        display: table-header-group;
        background-color: #fff !important;


  }



  table {
     font-family: sans-serif;
    font-size: 8px;
     width: auto;
  }

  tbody {
    counter-reset: rowNumber;
}

tbody tr {
    counter-increment: rowNumber;
}

tbody tr td:first-child::before {
    content: counter(rowNumber);


}

.logo-wrap tr {
  border-right: 1px solid #cbcbcb;
}

th, td th, {
  border-top: 1px solid #cbcbcb !important;
  text-align: center !important;


}

.pure-table .border-right th, .pure-table .border-right td{
    border-right: 1px solid #fff !important;
    border-left: 1px solid #fff !important;
    border-top: 1px solid #fff !important;
    border-bottom: 1px solid #fff !important;
     text-align: left !important;
     font-weight: bold;
     font-size: 6px;
}

tr{
    text-align: center !important;
}

.nowrap-header{
  white-space: nowrap !important;
}

.grow{
  width: 100%;
}




</style>



</head>
<body>



     <table>   
         <tr class="border-right">
            <th><apex:image url="/resource/1433857887000/StarwoodLogo600x400" width="75" height="35"/></th>
         </tr>
        <tr class="border-right">
            <td style="font-weight: bold;">ACQUISTIONS PIPELINE</td>
        </tr>
         <tr class="border-right">
            <td style="font-weight: bold;">SOF - Real Estate Pipeline</td>
        </tr>
        <tr class="border-right">
            <td>
              <apex:outputText style="font-weight: bold;" value="{0,date,MMMM dd, yyyy}">
                <apex:param value="{!TODAY()}" />
                </apex:outputText>
            </td>
        </tr>
    </table>


    <table class="pure-table pure-table-horizontal">


         <thead>


        <tr class="centre-cols">



         <th >
            Deal Name
         </th>
         <th>
            Stage
         </th>
          <th>
            Team
         </th>
          <th>
            Purchase Price
         </th>
         <th>
            Total SCG Equity
         </th>
         <th class="nowrap-header">
            Area <br/> (sq ft/sq m)
         </th>
         <th>
            Asset Class
         </th>
        <!--
         <th>
            Asset Type
         </th> -->
         <th>
            On/Off Marketing
         </th>
         <th>
            Bid
         </th>

         <th>
            Close Date
         </th>
         <th>
            SCG Office
         </th>
         <th>
            Transaction Facts
         </th>
         <th>
            Transaction Updates
         </th>
      </tr>

      </thead>
      <tbody>
        <apex:repeat value="{! accs }" var="a">  
          <tr>

            <td> ) &nbsp; <apex:outputField value="{! a.Name }"/> <br/> 
                        <div style="font-style: italic !important;">        <apex:outputField value="{! a.City__c}"/> <apex:outputField value="{! a.Country__c}"/> </div>


              </td> 
            <td>      <apex:outputField value="{! a.Stage__c }"/>      </td> 
            <td>      <apex:outputField value="{! a.Owner.Name }"/> </td> 
            <td>      <apex:outputField value="{! a.Purchase_Price_Rounded__c }"/> </td> 
            <td>      <apex:outputField value="{! a.Total_SCG_Equity_Rounded__c }"/> </td> 
            <td>      <apex:outputField value="{! a.Area_UOM__c }"/> </td> 
            <td>      <apex:outputField value="{! a.Asset_Class__c }"/> </td> 
          <!--  <td>      <apex:outputField value="{! a.Asset_Type__c }"/> </td> -->
            <td>      <apex:outputField value="{! a.On_Market_Off_Market__c }"/> </td> 
            <td>      <apex:outputField value="{! a.Bid__c }"/> 
                      <apex:outputField value="{! a.Bid_Date__c }" /> </td> 
            <td>      <apex:outputField value="{! a.Close_Date__c }"/> </td> 
            <td>      <apex:outputField value="{! a.SCG_Office__c }"/> </td> 
            <td style="text-align: left !important;  display:block" >      <apex:outputText value="{! a.Transaction_Facts__c }"  escape="false"/> </td> 
            <td style="text-align: left !important;" >      <apex:outputText value="{! a.Transaction_Updates__c }"  escape="false"/> </td> 

          </tr>

        </apex:repeat>

      </tbody>
    </table>



</body>
</apex:page>
  • Can you post a screencast to demonstrate the issue? – Ray Dehler Jul 21 '15 at 16:25
  • Thought it was working, but it's not. I havent posted the PDF output, it's just a bog standard page (standard controller) and displays a table of the accounts. – Michael Gill Jul 21 '15 at 20:38
  • What does the visual force page look like when you press the Run Deal report button? Are you querying for these accounts in your page? – Rao Jul 21 '15 at 20:40
  • Just add the code – Michael Gill Jul 21 '15 at 20:48
  • nothing crazy, no extension – Michael Gill Jul 21 '15 at 20:49
1

At the root of your problem is that you can't have any active content in a PDF. Anything that's "active" will either be ignored or cause your page to explode and not render at all. Without having seen your page code, I'm presuming what's happening is that any buttons you've used to set a sort order are being ignored, causing the page to render using the default sort order.

  • 1
    Thank you for your response. The button is not performing the sort. It opens a VFP for the result set from the standard List view. In fact regardless of my sorting column in the List view (e.g. I could even be sorting on the account name) that order in the list view is not the same order in the VFP. Hope that helps. – Michael Gill Jul 22 '15 at 7:17
  • 1
    If that's the case, please post the rest of your VF code. There may be something else going on in your code related to Component Behavior When Rendered as PDF causing issues. – crmprogdev Jul 22 '15 at 12:48
  • 1
    added the main code to the post - hope you can spot something – Michael Gill Jul 22 '15 at 19:22
  • 1
    I don't see anything at all unusual about your code. From your description, it sounds to me as though the list view controller is resetting itself and performing the query again before rendering the PDF. In essence, the view state isn't being maintained. That's why it changes regardless of what you sort on, including account name. – crmprogdev Jul 22 '15 at 20:30
  • @crmprogdev thank you, I was wondering if there's any option to render PDFs in lightning components? Do you think this feature will be available down the road? – Atlas Can Dec 12 at 13:01

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.