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
Rick Burmeister 5Rick Burmeister 5 

Newbie: Apex code for moving to next line??

Very new to this.  I have spent an hour on this and know you guys could answer this in 10 seconds.  I am simply trying to get the "mailing Country" info to the next line.  I have created an envelope button that is supposed to present info like this:

ABC Company
Attn:Accounts Receivable
New York, NY 12345
USA

But it incorrectly presents it like this:

ABC Company
Attn:Accounts Receivable
New York, NY 12345USA

How can I move the country info to the next line?  Here is my code:

<apex:page standardController="Contact" renderAs="PDF" showheader="false" sidebar="false"> <apex:styleSheet value="{!URLFOR($Resource.Envelope)}" /> <apex:panelGrid columns="1"> <apex:outputField value="{!Contact.owner.name}"/> <apex:outputText value="{!$Organization.Name}"/> <apex:outputField value="{!Contact.owner.Street}"/> <apex:panelGroup > <apex:outputField value="{!Contact.owner.City}"/>, <apex:outputField value="{!Contact.owner.State}"/>&nbsp; <apex:outputField value="{!Contact.owner.PostalCode}"/> </apex:panelGroup> </apex:panelGrid> <apex:panelGrid columns="1" style="padding-left:300px; margin-top:100px;width:100%"> <apex:outputField value="{!Contact.account.name}"/> <apex:panelGroup > Attn: <apex:outputField value="{!Contact.name}"/> </apex:panelGroup> <apex:outputField value="{!Contact.mailingStreet}"/> <apex:panelGroup > <apex:outputField value="{!Contact.mailingCity}"/>, <apex:outputField value="{!Contact.mailingState}"/>&nbsp; <apex:outputField value="{!Contact.mailingPostalCode}"/> <apex:outputField value="{!Contact.mailingCountry}"/> </apex:panelGroup> </apex:panelGrid> </apex:page>
Best Answer chosen by Rick Burmeister 5
Ugur KayaUgur Kaya
Hi Rick,

Did you try <br/> ?
 

All Answers

Rick Burmeister 5Rick Burmeister 5
reposting that code...


<apex:page standardController="Contact" renderAs="PDF" showheader="false" sidebar="false">

<apex:styleSheet value="{!URLFOR($Resource.Envelope)}" />

    <apex:panelGrid columns="1">
        <apex:outputField value="{!Contact.owner.name}"/>
        <apex:outputText value="{!$Organization.Name}"/>
        <apex:outputField value="{!Contact.owner.Street}"/>
        <apex:panelGroup >
            <apex:outputField value="{!Contact.owner.City}"/>,
            <apex:outputField value="{!Contact.owner.State}"/>&nbsp;
            <apex:outputField value="{!Contact.owner.PostalCode}"/>
        </apex:panelGroup>
    </apex:panelGrid>

    <apex:panelGrid columns="1" style="padding-left:300px; margin-top:100px;width:100%">
        <apex:outputField value="{!Contact.account.name}"/>
        <apex:panelGroup >
            Attn: <apex:outputField value="{!Contact.name}"/>
        </apex:panelGroup>
        <apex:outputField value="{!Contact.mailingStreet}"/>
        <apex:panelGroup >
            <apex:outputField value="{!Contact.mailingCity}"/>,
            <apex:outputField value="{!Contact.mailingState}"/>&nbsp;
            <apex:outputField value="{!Contact.mailingPostalCode}"/>
        <apex:outputField value="{!Contact.mailingCountry}"/>
        </apex:panelGroup>
    </apex:panelGrid>

</apex:page>
Ugur KayaUgur Kaya
Hi Rick,

Did you try <br/> ?
 
This was selected as the best answer
Rick Burmeister 5Rick Burmeister 5
excellent!  thank you very much Ugur!  that saved me a lot of time!