+ Start a Discussion
augiewazaugiewaz 

Text not outputing the way it should

Hi,

 

If for example a user enters the following into the Description field on an Events object:

Agenda Note 1

Agenda Note 2

Agenda Note 3

 

I have created a pdf with Visualforce and I want the Description field to output the data as shown above. However, it appears like this:

Agenda Note 1 Agenda Note 2 Agenda Note 3

 

Does anyone know how to get around this (if its possible at all)?

 

Here is my code:

 

<apex:pageBlock title="Meeting Information" mode="edit" > <apex:pageBlockTable title="Bi-Weekly Meetings" value="{!events}" var="e" columns="1" width="95%" > <apex:column> <b>Meeting Date</b><br />{!e.StartDateTime} (Duration: {!e.DurationInMinutes} minutes)<br /> <p><b>Meeting Agenda</b><br />{!e.Description}</p> <p><hr width="100%" /></p> </apex:column> </apex:pageBlockTable> </apex:pageBlock>

 

Thanks in advance

Warren

 

Message Edited by augiewaz on 04-03-2009 06:24 AM
Best Answer chosen by Admin (Salesforce Developers) 
augiewazaugiewaz

I have worked it out. You need to use the tag 'outputField'

 

works like a charm

All Answers

Srinivas_V2Srinivas_V2

<apex:page Controller="test" renderAs="pdf">
 <apex:pageBlock title="Account Information" mode="edit" >
        <apex:pageBlockTable title="accounts" value="{!accounts}" var="a" columns="1" width="95%" >
            <apex:column>
               {!a.Name}<br />
               {!a.Name}<br />
               {!a.Name}
            </apex:column>       
         </apex:pageBlockTable>
      </apex:pageBlock>
</apex:page>

 

public class test
{
        list<Account> lstAccount = new list<Account>();
        public list<Account> getaccounts()
        {
              lstAccount = [select Name from Account ]   ;
              return lstAccount;
        }

 

augiewazaugiewaz

The text is all coming from one field so I would not be able to use the <br /> option.

 

User enters the text into a field like so:

Agenda Note 1

Agenda Note 2

Agenda Note 3

 

The output of the field appears like this:

Agenda Note 1 Agenda Note 2 Agenda Note 3

 

I cannot use <br /> as I do not know where the use has entered a carriage return.

 

Warren

Ron HessRon Hess
try outputText value="description", rather than just putting out the raw expression for the description.
Srinivas_V2Srinivas_V2
it wont work ron. i tried that.
augiewazaugiewaz

I have worked it out. You need to use the tag 'outputField'

 

works like a charm

This was selected as the best answer
Srinivas_V2Srinivas_V2
Good.