Skip to content

Instantly share code, notes, and snippets.

@zaki-yama
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save zaki-yama/561a3317c0849a8391aa to your computer and use it in GitHub Desktop.

Select an option

Save zaki-yama/561a3317c0849a8391aa to your computer and use it in GitHub Desktop.
[Salesforce]Visualforceをpdf出力するサンプル
<apex:page renderAs="pdf" standardController="Opportunity" showHeader="false" sidebar="false" applyBodyTag="false" applyHtmlTag="false">
<html>
<head>
<style>
@page {
size: 8.27in 11.69in;
margin: 10px;
}
body {
font-family: 'Arial Unicode MS';
}
.opportunityName {
width: 100%;
text-align: center;
margin-bottom: 10px;
font: 20pt;
}
.opportunityItems th {
text-align: center;
background-color: #cccccc;
}
.opportunityItems .unitPrice, .quantity {
text-align: right;
}
</style>
</head>
<body>
<div class="opportunityName">
{!opportunity.name}
</div>
<div class="opportunityItems">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<th width="40%"> 商品名 </th>
<th width="30%"> 単価 </th>
<th width="30%"> 数量 </th>
</tr>
<apex:repeat value="{!opportunity.opportunityLineItems}" var="lineItem" >
<tr>
<td> {!lineItem.product2.name} </td>
<td class="unitPrice"> {!lineItem.unitPrice} </td>
<td class="quantity"> {!lineItem.quantity} </td>
</tr>
</apex:repeat>
</table>
</div>
</body>
</html>
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment