function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LoïkLoïk 

VF : renderAs PDF Auto Adjust Table

Hello,

 

I have a visual force page that renders content for a PDF.  The visual force code uses apex:repeat to display a table (for each entity) that contains data.

 The problem I am encountering is line 141. He is rendering :

 

FirstName   | LastName   | Telephone   |

 _________|__________| __________ |

 

How i can auto-adjust Contact table ?

 

Please make suggestions.

 

Thanks,

 

 

 

<apex:page standardController="Account" showHeader="true" renderAs="pdf">
<body>
<apex:stylesheet value="{!URLFOR($Resource.pdfresource, 'styles.css')}"/>
<apex:image value="{!URLFOR($Resource.pdfresource, 'logo.png')}"/>
<apex:panelGrid columns="3" styleClass="companyTable" width="100%">
<apex:outputText value="{!Account.Name}" styleClass="companyName"/>
<apex:outputText value="{!Account.EtablissementStreet1__c}"/>
<apex:outputText value="{!Account.EtablissementCity__c}, {!Account.EtablissementZipCode__r.name}"/>
<apex:outputText value="{!$Organization.Phone}"/>
</apex:panelGrid>

 

<!-- Qualification : Services / Partenaires -->


<apex:outputPanel layout="block" styleClass="Contact"/>
<apex:panelGrid columns="1" styleClass="centered" width="100%">
<apex:outputText value="Qualification : Services / Partenaires" styleClass="customerName"/>
</apex:panelGrid>

<apex:panelGrid columns="2" styleClass="companyTable" width="100%">
<apex:outputText value="Environnement / Services : {!Account.q_EnvironmentServices__c}"/>
<apex:outputText value="Nombre de Véhicule : {!Account.q_NbDeVehicule__c}"/>
<apex:outputText value="Travailleurs Isolés (Equipés DATI / PTI) : {!Account.q_TravailleursIsoles__c}"/>
<apex:outputText value="Véhicules Géolocalisés : {!Account.q_VehiculesGeolocalises__c}"/>
<apex:outputText value="Échéance du Contrat Géolocalisation : {!Account.q_EndDateContratGeolocalisation__c}"/>
<apex:outputText value="Commentaires : {!Account.q_Commentaires__c}"/>
</apex:panelGrid>


<apex:outputPanel layout="block" styleClass="Contact"/>
<apex:panelGrid columns="1" styleClass="centered" width="100%">
<apex:outputText value="Account# {!Account.name}" styleClass="customerName"/>
<apex:outputField value="{!Account.lastmodifieddate}" style="text-align:right"/>
</apex:panelGrid>

<apex:panelGrid columns="1">
<apex:outputText value="{!Account.EtablissementStreet1__c}"/>
<apex:outputText value="Phone: {!Account.phone}"/>
</apex:panelGrid>

<apex:outputPanel layout="block" styleClass="ContactSmall"/>

<apex:panelGrid columns="2" columnClasses="left,right" width="100%">

<apex:outputText value="Contacts Référencés :" style="font-weight:bold"/>
<apex:outputText value="Principal:" style="font-weight:bold"/>

</apex:panelGrid>


<apex:PanelGrid columns="6" frame="box" width="100%" cellspacing="1" columnClasses="left" >

<apex:outputText value="Prénom: " style="text-align:center;font-weight:bold"/>
<apex:outputText value="Nom: " style="text-align:center;font-weight:bold"/>
<apex:outputText value="Téléphone: " style="text-align:center;font-weight:bold"/>
<apex:outputText value="Mobile: " style="text-align:center;font-weight:bold"/>
<apex:outputText value="Fonction: " style="text-align:center;font-weight:bold"/>

</apex:panelGrid>

<apex:repeat value="{!Account.Contacts}" var="contacts" >

<apex:PanelGrid columns="6" frame="box" width="100%" cellpadding="1" cellspacing="1" columnClasses="left" >

<apex:panelGroup >
<td><apex:outputField value="{!contacts.firstname}" rendered="{!not(isnull(contacts.firstname))}"/>
<apex:outputText value="__________" rendered="{!isnull(contacts.firstname)}" /> </td>
</apex:panelGroup>

<apex:panelGroup >
<apex:outputField value="{!contacts.lastname}" rendered="{!not(isnull(contacts.lastname))}"/>
<apex:outputText value="__________" rendered="{!isnull(contacts.lastname)}" />
</apex:panelGroup>

<apex:panelGroup >
<apex:outputField value="{!contacts.phone}" rendered="{!not(isnull(contacts.phone))}"/>
<apex:outputText value="__________" rendered="{!isnull(contacts.phone)}" />
</apex:panelGroup>

<apex:panelGroup >
<apex:outputField value="{!contacts.mobilephone}" rendered="{!not(isnull(contacts.mobilephone))}"/>
<apex:outputText value="__________" rendered="{!isnull(contacts.mobilephone)}" />
</apex:panelGroup>

<apex:panelGroup >
<apex:outputField value="{!contacts.Fonction__c}" rendered="{!not(isnull(contacts.Service__c))}"/>
<apex:outputText value="____________________" rendered="{!isnull(contacts.Service__c)}" />

</apex:panelGroup>

<apex:outputField value="{!contacts.Main__c}" style="font-weight:bold"/>

</apex:panelGrid>
</apex:repeat>
</body>
</apex:page>