You need to sign in to do that
Don't have an account?
rajesh kumar 10
I have a doubt on controller string splitting ? can any help me pls!
I have a problem with string spliting that when i create a pdf the table is excceding because of 'description' so i want to split that 'description' string i am trying to do it but unable to fix it i am sending the contrlooer and visualforce code can any try to help me out...
MY controller:
public class QuotePDFAustria{
Public Quote qut{get;set;}
Public List<QuoteLineItem> QuLiIt{get;set;}
Public Date dat{get;set;}
Public QuotePDFAustria(ApexPages.StandardController controller){
qut = [SELECT id,name,Payment_Terms__c,Notes__c,Customer__r.name,Customer__r.City__c,Customer__r.State__c,Customer__r.Postal_Code__c,Customer__r.Country__c,GrandTotal,Quote_Address_To__r.name,Quote_Address_To__r.Salutation,Quote_Address_To__r.LastName,Quote_Address_To__r.email,Quote_Address_To__r.Phone,Opportunity.Primary_Inside_Sales__r.name,Primary_Inside_Sales__r.name,Primary_Inside_Sales_Email__c,Quote_Date__c,opportunity.Primary_Outside_Sales__r.name,opportunity.Primary_Outside_Sales__r.Phone,opportunity.Primary_Outside_Sales__r.Email,opportunity.Primary_Outside_Sales__r.fax,opportunity.Primary_Outside_Sales__r.Title,Inside_Sales_Fax__c,Inside_Sales_Phone__c,Inside_Sales_Title__c FROM Quote WHERE id =: ApexPages.CurrentPage().getParameters().get('id')];
QuLiIt = [SELECT id,LineNumber,Quantity,Item_Number__c,Asset__r.Model__c,Part_Description__c,UnitPrice,Asset__r.SerialNumber FROM QuoteLineItem WHERE QuoteId =: qut.id];
if(qut.Quote_Date__c != null)
dat = qut.Quote_Date__c + 30;
}
}
and my Visualforce page:
<apex:page standardController="Quote" extensions="QuotePDFAustria" renderAs="pdf">
<head>
<style type="text/css">
@PageBreak{
page-break:always;
page-break-inside:avoid;
}
@media print{
table {page-break-inside:auto }
tr { page-break-inside:avoid; page-break-after:auto }
}
@page {
margin-top: 20%; margin-bottom: 110px;
margin-left:50px; margin-right:50px;
@top-center {
content: element(header);
}
@bottom-left {
content: element(footer);
height: 500px;
}
}
div.footer {
position: running(footer);
}
div.header {
margin:0 50px 0 0;
position: running(header);
}
table.gridtable {
font-family: verdana,arial,sans-serif;
font-size:15px;
color:#000;
border-width: 1px;
border-color: #000;
border-collapse: collapse;
}
table.gridtable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #000;
}
table.gridtable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #000;
}
</style>
</head>
<div class="footer">
<table border="0" width="100%" height = "100%" cellspacing="0" cellpadding="0">
<tr>
<td width="70%" >
<b>CCI Valve Technology GmbH</b><br/>
Lemböckgasse 63/1<br/>
AT-1230 Vienna<br/>
Austria
</td>
<td width="30%">
Tel.: +43-1-869 27 40<br/>
Fax : +43-1-865 36 03<br/>
<b>www.ccivalve.com</b><br/>
e-mail : cci@ccivalve.at
</td>
</tr>
</table>
</div>
<div class="header" align="center" >
<div><apex:image height="110px" width="230pk" value="{!$Resource.CC_IMI}"/></div>
</div>
<apex:form >
<!-- This Section is for PAGE 1-->
<table class="gridtable" width="100%">
<tr>
<td colspan="2" width="50%" style="vertical-align:Top;padding-top:5px;padding-left:20px;">
<u><apex:outputText value="Customer :"/></u>
<p><b>{!qut.Customer__r.name}</b><br/>
{!qut.Customer__r.City__c}<br/>
{!qut.Customer__r.State__c} {!qut.Customer__r.Postal_Code__c}<br/>
<b>{!qut.Customer__r.Country__c}</b>
</p>
</td>
<td colspan="2" width="50%" style="vertical-align:Top;padding-top:5px;padding-left:20px;">
<u><apex:outputText value="Supplier :"/></u>
<p><b>CCI Valve Technology GmbH</b><br/>
Lemböckgasse 63/1<br/>
AT-1230 Vienna<br/>
<b>Austria</b>
</p>
</td>
</table><br/>
<table width="100%" class="gridtable">
<tr align="center" style="background-color:#C0C0C0;">
<th width="50%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="QUOTATION No.:"/></th>
<th width="50%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qut.name}"/></th>
</tr>
</table><br/><br/>
Dear {!qut.Quote_Address_To__r.Salutation} {!qut.Quote_Address_To__r.LastName},<br/><br/>
We thank you for your inquiry and offer in accordance with the previous order ............... with the negotiated
purchase and warranty conditions as follows.<br/><br/><br/>
When ordering, we ask you to refer to the old order and confirm the validity if this purchasing and
warranty conditions.<br/><br/>
<table width="100%" class="gridtable">
<tr align="center" style="background-color:#C0C0C0;page-break:after:auto;page-break-inside:avoid;">
<td width="5%" style="padding-top:10px;padding-bottom:10px">Pos.</td>
<td width="5%" style="padding-top:10px;padding-bottom:10px">Q</td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">Article No.</td>
<td width="40%" style="padding-top:10px;padding-bottom:10px">Description</td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">USD/pc</td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">USD/Pos</td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">SL No.</td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">Valve Type</td>
</tr>
<apex:repeat value="{!QuLiIt}" var="qli">
<tr style="page-break:after:auto;page-break-inside:avoid;">
<td width="5%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.Item_Number__c}"/></td>
<td width="5%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.Quantity}"/></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.LineNumber}"/></td>
<td width="40%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.Part_Description__c}"/></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.UnitPrice}"/></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{0,Number,###,###,###.00}"><apex:param value="{!qli.UnitPrice * qli.Quantity}"/></apex:outputText></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.Asset__r.SerialNumber}"/></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.Asset__r.Model__c}"/></td>
</tr>
</apex:repeat>
<tr style="background-color:#C0C0C0;page-break:after:auto;page-break-inside:avoid;">
<td width="5%"></td>
<td width="5%"></td>
<td width="10%"></td>
<td width="40%" style="text-align:right;padding-top:10px;padding-bottom:10px"><b>TOTAL</b></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">USD/pos.</td>
<td width="10%"><apex:outputText value="{0,Number,###,###,###.00}"><apex:param value="{!qut.GrandTotal}"/></apex:outputText></td>
<td width="10%"></td>
<td width="10%"></td>
</tr>
</table>
</apex:form>
</apex:page>
MY controller:
public class QuotePDFAustria{
Public Quote qut{get;set;}
Public List<QuoteLineItem> QuLiIt{get;set;}
Public Date dat{get;set;}
Public QuotePDFAustria(ApexPages.StandardController controller){
qut = [SELECT id,name,Payment_Terms__c,Notes__c,Customer__r.name,Customer__r.City__c,Customer__r.State__c,Customer__r.Postal_Code__c,Customer__r.Country__c,GrandTotal,Quote_Address_To__r.name,Quote_Address_To__r.Salutation,Quote_Address_To__r.LastName,Quote_Address_To__r.email,Quote_Address_To__r.Phone,Opportunity.Primary_Inside_Sales__r.name,Primary_Inside_Sales__r.name,Primary_Inside_Sales_Email__c,Quote_Date__c,opportunity.Primary_Outside_Sales__r.name,opportunity.Primary_Outside_Sales__r.Phone,opportunity.Primary_Outside_Sales__r.Email,opportunity.Primary_Outside_Sales__r.fax,opportunity.Primary_Outside_Sales__r.Title,Inside_Sales_Fax__c,Inside_Sales_Phone__c,Inside_Sales_Title__c FROM Quote WHERE id =: ApexPages.CurrentPage().getParameters().get('id')];
QuLiIt = [SELECT id,LineNumber,Quantity,Item_Number__c,Asset__r.Model__c,Part_Description__c,UnitPrice,Asset__r.SerialNumber FROM QuoteLineItem WHERE QuoteId =: qut.id];
if(qut.Quote_Date__c != null)
dat = qut.Quote_Date__c + 30;
}
}
and my Visualforce page:
<apex:page standardController="Quote" extensions="QuotePDFAustria" renderAs="pdf">
<head>
<style type="text/css">
@PageBreak{
page-break:always;
page-break-inside:avoid;
}
@media print{
table {page-break-inside:auto }
tr { page-break-inside:avoid; page-break-after:auto }
}
@page {
margin-top: 20%; margin-bottom: 110px;
margin-left:50px; margin-right:50px;
@top-center {
content: element(header);
}
@bottom-left {
content: element(footer);
height: 500px;
}
}
div.footer {
position: running(footer);
}
div.header {
margin:0 50px 0 0;
position: running(header);
}
table.gridtable {
font-family: verdana,arial,sans-serif;
font-size:15px;
color:#000;
border-width: 1px;
border-color: #000;
border-collapse: collapse;
}
table.gridtable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #000;
}
table.gridtable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #000;
}
</style>
</head>
<div class="footer">
<table border="0" width="100%" height = "100%" cellspacing="0" cellpadding="0">
<tr>
<td width="70%" >
<b>CCI Valve Technology GmbH</b><br/>
Lemböckgasse 63/1<br/>
AT-1230 Vienna<br/>
Austria
</td>
<td width="30%">
Tel.: +43-1-869 27 40<br/>
Fax : +43-1-865 36 03<br/>
<b>www.ccivalve.com</b><br/>
e-mail : cci@ccivalve.at
</td>
</tr>
</table>
</div>
<div class="header" align="center" >
<div><apex:image height="110px" width="230pk" value="{!$Resource.CC_IMI}"/></div>
</div>
<apex:form >
<!-- This Section is for PAGE 1-->
<table class="gridtable" width="100%">
<tr>
<td colspan="2" width="50%" style="vertical-align:Top;padding-top:5px;padding-left:20px;">
<u><apex:outputText value="Customer :"/></u>
<p><b>{!qut.Customer__r.name}</b><br/>
{!qut.Customer__r.City__c}<br/>
{!qut.Customer__r.State__c} {!qut.Customer__r.Postal_Code__c}<br/>
<b>{!qut.Customer__r.Country__c}</b>
</p>
</td>
<td colspan="2" width="50%" style="vertical-align:Top;padding-top:5px;padding-left:20px;">
<u><apex:outputText value="Supplier :"/></u>
<p><b>CCI Valve Technology GmbH</b><br/>
Lemböckgasse 63/1<br/>
AT-1230 Vienna<br/>
<b>Austria</b>
</p>
</td>
</table><br/>
<table width="100%" class="gridtable">
<tr align="center" style="background-color:#C0C0C0;">
<th width="50%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="QUOTATION No.:"/></th>
<th width="50%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qut.name}"/></th>
</tr>
</table><br/><br/>
Dear {!qut.Quote_Address_To__r.Salutation} {!qut.Quote_Address_To__r.LastName},<br/><br/>
We thank you for your inquiry and offer in accordance with the previous order ............... with the negotiated
purchase and warranty conditions as follows.<br/><br/><br/>
When ordering, we ask you to refer to the old order and confirm the validity if this purchasing and
warranty conditions.<br/><br/>
<table width="100%" class="gridtable">
<tr align="center" style="background-color:#C0C0C0;page-break:after:auto;page-break-inside:avoid;">
<td width="5%" style="padding-top:10px;padding-bottom:10px">Pos.</td>
<td width="5%" style="padding-top:10px;padding-bottom:10px">Q</td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">Article No.</td>
<td width="40%" style="padding-top:10px;padding-bottom:10px">Description</td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">USD/pc</td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">USD/Pos</td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">SL No.</td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">Valve Type</td>
</tr>
<apex:repeat value="{!QuLiIt}" var="qli">
<tr style="page-break:after:auto;page-break-inside:avoid;">
<td width="5%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.Item_Number__c}"/></td>
<td width="5%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.Quantity}"/></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.LineNumber}"/></td>
<td width="40%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.Part_Description__c}"/></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.UnitPrice}"/></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{0,Number,###,###,###.00}"><apex:param value="{!qli.UnitPrice * qli.Quantity}"/></apex:outputText></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.Asset__r.SerialNumber}"/></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px"><apex:outputText value="{!qli.Asset__r.Model__c}"/></td>
</tr>
</apex:repeat>
<tr style="background-color:#C0C0C0;page-break:after:auto;page-break-inside:avoid;">
<td width="5%"></td>
<td width="5%"></td>
<td width="10%"></td>
<td width="40%" style="text-align:right;padding-top:10px;padding-bottom:10px"><b>TOTAL</b></td>
<td width="10%" style="padding-top:10px;padding-bottom:10px">USD/pos.</td>
<td width="10%"><apex:outputText value="{0,Number,###,###,###.00}"><apex:param value="{!qut.GrandTotal}"/></apex:outputText></td>
<td width="10%"></td>
<td width="10%"></td>
</tr>
</table>
</apex:form>
</apex:page>
Add this style property to your column (i.e to table.gridtable td ) n check if it works for you
Thanks,
N.J
Thanks.
But the main issue is i want it to be done in my controller not in visualforce page
can any one help me out?
thanks in advance