In the video below I am showing how to create a table and compare more than 2 Accounts in a single Salesforce page. User can select multiple records, then click on a custom button and view a table with the values associated to specific fields which i added in VisualForce page and Apex Class.
Video also illustrates how to download the table as a PDF file.
VisualForce Code:
<apex:page standardController="Account" recordSetVar="accounts" extensions="AccountExtension">
<style>
#account {
border-collapse: collapse;
border-color: #515A5A;
border-style:solid;
border-width:thin;
table-layout: fixed;
word-wrap:break-word;
height:200px;
}
#account td, #account th {
border: 1px solid #CCD1D1;
font-size:20;
Width:250px;
Height:60px;
word-wrap:break-word;
}
#account tr:nth-child(even){background-color: #FDFEFE;}{width:150px;}
#account tr:nth-child(odd){background-color: #FDFEFE;}{width:150px;}
#account tr:hover {background-color: #D6EAF8;}
#account tr{
width : 200px;
}
#account th {
background-color: #2874A6;
color: white;
width:300px;
font-size:20;
word-wrap:break-word;
font-weight:normal;
}
</style>
<table id="account" style="font-size: 14px;width:300px;table-layout:fixed" cellpadding="8">
<tr>
<th>Name:</th>
<apex:repeat value="{!selectedAccounts}" var="acc">
<td>{!acc.Name}</td>
</apex:repeat>
</tr>
<tr>
<th>Active:</th>
<apex:repeat value="{!selectedAccounts}" var="acc">
<td>{!acc.Active__c}</td>
</apex:repeat>
</tr>
<tr>
<th>Type:</th>
<apex:repeat value="{!selectedAccounts}" var="acc">
<td>{!acc.Type}</td>
</apex:repeat>
</tr>
<tr>
<th>Industry:</th>
<apex:repeat value="{!selectedAccounts}" var="acc">
<td>{!acc.Industry}</td>
</apex:repeat>
</tr>
<tr>
<th>Number Of Employees:</th>
<apex:repeat value="{!selectedAccounts}" var="acc">
<td>{!acc.NumberOfEmployees}</td>
</apex:repeat>
</tr>
<tr>
<th>Annual Revenue:</th>
<apex:repeat value="{!selectedAccounts}" var="acc">
<td>{!acc.AnnualRevenue}</td>
</apex:repeat>
</tr>
</table>
</apex:page>