1

I am trying to render a PDF with related object list without column titles and grid lines.

I found this apex code for the table :

    <apex:pageBlock title="Lines List">
    <apex:pageBlockTable align="center" value="{!opportunity.lines__r}" var="line">
    <apex:column value="{!line.Name}"/>
    <apex:column value="{!line.description__c}"/>
    </apex:pageBlockTable>
    </apex:pageBlock>

This is showing the needed info. However it also shows column titles and grid lines, which I don't want to see... Please note that my VF page is coded in HTML, as I do not have knowledge in Apex...

Thank you much in advance for your help.

1
  • You need to have custom CSS for the related list. Is there a link at the top of your visualforce page to a resource containing the CSS for the page? You'll want to modify that if there is.
    – crmprogdev
    Sep 23, 2017 at 17:55

2 Answers 2

2

You can use an apex:dataTable instead:

<apex:dataTable align="center" value="{!opportunity.lines__r}" var="line">
    <apex:column value="{!line.Name}"/>
    <apex:column value="{!line.description__c}"/>
</apex:dataTable>

apex:dataTable behaves similarly to apex:pageBlockTable but without styling.

1
  • I prefer this. You can also use <apex:repeat> tag if needed to iterate over a collection. Which is good. Thanks!
    – SfdcBat
    Sep 23, 2017 at 18:59
0

Here is an example. Hope this can help you thinking:

<apex:page standardController="Opportunity">
<style>
table {
    font-family: arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

td, th {
    border: 0px;
    text-align: left;
    padding: 8px;
}

tr:nth-child(even) {
    border: 0px;
}
</style>    
 <table>
  <tr>
    <td>{!opportunity.Contact_lookup__r.Name}</td>
    <td>{!opportunity.Contact_lookup__r.Description}</td>
  </tr>
</table>
</apex:page>

enter image description here

No borders , No column titles. Change the values in CSS accordingly to get what you want.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .