You need to sign in to do that
Don't have an account?
RelaxItsJustCode
Need help with VF page formatting of table? Will give kudos to anyone who contributes.
Why isn't my formatting and table showing for this VF page? Please help I'll give kudos to anyone that contributes.
Thank you,
Steve Laycock
<apex:page standardController="Contract" showHeader="false" sidebar="false" standardStylesheets="false" renderAs="pdf"> <!-- Sales Invoice reference for the following VF markup --> <apex:variable var="Contract1" value="{!Contract}"/> <!-- ************************* BEGIN COPY / PASTE HERE ******************************** --> <!-- Styles --> <apex:variable var="styleFontColor" value="#000000" /> <apex:variable var="styleHeaderBGColor" value="#E4EAF4" /> <apex:variable var="styleHeaderFontColor" value="#000000" /> <apex:variable var="styleLineColor" value="#3B5E91" /> <head> <style type="text/css"> body,td,th, h1 { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:7.5pt; color:{!styleFontColor}; } .email table{ width:100%; border-collapse:collapse; margin-bottom:10px; } .email table.tableSummary{ width:250px; } .email table.tableDescription{ width:68%; margin-top:10px; margin-bottom:5px; } .email table.noBottomMargin{ margin-bottom:0px; } .email table.tableTaxSummary, .email table.tableAdditional { margin-top:10px; margin-bottom:0px; } .email table h1{ font-size:20px; font-weight:700; text-transform:uppercase; text-align:right; margin:0; } .email table td, .email table th{ padding:5px; } .email table th{ background-color:{!styleHeaderBGColor}; color:{!styleHeaderFontColor}; } .email table th.nobg{ background-color:transparent; color:{!styleFontColor}; } .email table td.noPadding{ padding:0px; } .email table td.noPaddingLeft{ padding-left:0px; } .email table td.alignTop{ vertical-align:top; } .email table .textAlignLeft{ text-align:left; } .email table .textAlignCenter{ text-align:center; } .email table .textAlignRight{ text-align:right; } .email table.boxed{ border-left:1px solid {!styleLineColor}; border-top:1px solid {!styleLineColor}; } .email table.boxed th, .email table.boxed td{ border-left:1px solid {!styleLineColor}; border-top:1px solid {!styleLineColor}; } .email table.boxedNoTop{ border-top:none; border-left:none; } .email table.boxedNoBottom{ border-bottom:none; } .email table.boxedNoTop td.boxedNoTop{ border-top:none ; } .email table.boxed th{ border-right:1px solid {!styleLineColor}; border-bottom:1px solid {!styleLineColor}; } .email table.boxed th.noLines{ border-right:1px solid {!styleLineColor}; border-left:none; border-top:none; border-bottom:none; } .email table.boxed td{ border-right:1px solid {!styleLineColor}; border-bottom:1px solid {!styleLineColor}; } .email table.boxed td.widthLineNumbers{width:15pt;} .email table.boxed td.widthSmall{width:45pt;} .email table.boxed td.widthMedium{width:75pt;} .widthMedium{width:75pt;} .email table.boxed td span.description{ font-size:85%; font-style:italic; display:block; } .boxedtop { border-top:1px solid {!styleLineColor}; } .boxed { border-left:1px solid {!styleLineColor}; border-right:1px solid {!styleLineColor}; border-bottom:1px solid {!styleLineColor}; } table { page-break-inside:auto } tr { page-break-inside:avoid; page-break-after:auto } @page { @bottom-right {content:"Page " counter(page) " of " counter(pages); font-family:Verdana, Arial, Helvetica, sans-serif; font-size:7.5pt; font-weight:bold; padding-bottom;25px; } } </style> </head> <table> <tr> <td> <div> <apex:outputText value="{!Contract1.Contact_Email__c} (Email)" rendered="{!Contract1.Contact_Email__c!=''}" escape="false"/> </div> </td> </tr> </table> <apex:variable var="lblProforma" value="PROFORMA" /> <table> <tr> <td> <h1>{!lblProforma}</h1> </td> </tr> </table> <apex:variable var="lblContractNumber" value="Contract Number" /> <apex:variable var="lblContractTotal" value="Contract Amount" /> <apex:outputPanel rendered="{!Contract1.ContractNumber != ''}"> <table styleClass="boxed noBottomMargin"> <tr> <th>{!lblContractNumber}</th> <td>{!Contract1.ContractNumber}</td> </tr> <tr> <th>{!lblContractTotal}</th> <td> <td>{!Contract1.Total_Maintenance_Price__c}</td> </td> </tr> </table> </apex:outputPanel> </apex:page>
Hi
For showing 2 digit after decimal point you can use :
<apex:outputText value="{0, number, ###,###,###,##0.00}">
<apex:param value="{!QuoteLineItem.UnitPrice}"/> <!- Include your number field in the Param--->
</apex:outputText>
Also you can try for Currency in USD
<apex:outputText value="{0, number, $###,###,###,##0.00}">
<apex:param value="{!QuoteLineItem.UnitPrice}"/> <!- Include your number field in the Param--->
</apex:outputText>
or
<apex:outputText value="{0, number, $###,###,###,###,##0.000000}">
<apex:param value="{!myObject.My_Value__c}"/>
</apex:outputText>
All Answers
Are you sure your Contract_Email__c is populated? Are you passing in a Contract ID into the VF page?
Is your contract number populated?
Yup both fields are populated. Any ideas?
Thank you,
Steve Laycock
This is what is rendering:
slaycock@aps.us (Email)
PROFORMA
Contract Number 00001214
Contract Amount 168.0
I would like to see these fields in a small table in the upper right hand corner of the pdf rendered by the page.
Any ideas?
Thank you,
Steve
Add applyHtmlTag=False to your page tag. This will allow your CSS to work for API version 27+.
<apex:page standardController="Contract" showHeader="false" sidebar="false" standardStylesheets="false" renderAs="pdf" applyHtmlTag="false">
Change your td,th styles to apply to table.
Thank you for getting back to me. I have found and learned a great deal in doing this task.
Anyway, I've already got this part working, but I really appriciate your response and as promised I've given your kudos.
Thank you,
Steve Laycock
Steve, what was your solution? Thanks!
Tim as you may not know but people that contribute to my questions I have made an effort recently to give all kudos no matter what role they play in me successfully completing the project.
I will post my final code on Monday, what I did is basically create the process off of Opportunity and OpportunityLineItem. This is something I can refactor into the Contract and Contract_Line_Item__c VF page creation.
I have a few adjustments to the code I have to make but once done on Monday I will return to this post and publish them with tags.
Thank you for your assistance.
Steve Laycock
Steve,
Looking forward to seeing your code on Monday :-) When you post it, please post your API version as well.
Enjoy the rest of your weekend!
Tim
Here is the code but I'm having problems with formating the invoice amount on the VF page.
it will show $1,000.5 = instead of $1,000.50
OR
it will show $1,000 = instead of $1,000.00
Everything esle seems to work just fine. Any ideas as to how to format the invoice amount to currency USD with commas and a two digit decimal?
Here is the code.
Thank you,
Steve Laycock
Hi
For showing 2 digit after decimal point you can use :
<apex:outputText value="{0, number, ###,###,###,##0.00}">
<apex:param value="{!QuoteLineItem.UnitPrice}"/> <!- Include your number field in the Param--->
</apex:outputText>
Also you can try for Currency in USD
<apex:outputText value="{0, number, $###,###,###,##0.00}">
<apex:param value="{!QuoteLineItem.UnitPrice}"/> <!- Include your number field in the Param--->
</apex:outputText>
or
<apex:outputText value="{0, number, $###,###,###,###,##0.000000}">
<apex:param value="{!myObject.My_Value__c}"/>
</apex:outputText>