Visualforce - APEX : Création d'un PDF récapitulatif
Bonjour,
Je souhaiterai créer un fichier PDF récapitulatif de ma base de données Salesforce Contact, à partir de Visualforce.
J'ai trouvé ça sur le net :
1/ Sélection des données à afficher (mais la page s'ouvre vide… help :?)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <apex:page standardController="Contact" >
<apex:form >
<apex:pageBlock mode="detail" >
<apex:pageBlockButtons location="top">
<apex:commandButton action="{!edit}" value="Edit"/>
<apex:commandButton action="{!delete}" value="Delete"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1" title="Informations Contact">
<apex:outputField value="{!Contact.Name}"/>
<apex:outputField value="{!Contact.Title}"/>
<apex:outputField value="{!Contact.Phone}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page> |
2/ Génération d'un PDF
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <apex:page standardController="Account" renderAs="pdf" applyBodyTag="false">
<head>
<style>
body { font-family: 'Arial Unicode MS'; }
.companyName { font: bold 30px; color: red; }
</style>
</head>
<body>
<center>
<h1>New Account Name!</h1>
<apex:panelGrid columns="1" width="100%">
<apex:outputText value="{!account.Name}" styleClass="companyName"/>
<apex:outputText value="{!NOW()}"></apex:outputText>
</apex:panelGrid>
</center>
</body>
</apex:page> |
Merci !