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
Bill WoodsonBill Woodson 

line breaks in pageblocktable column

Hello,

I am retrieving notes which have line breaks in the body.  I have created a custom extension and pageblocktable to display the note data including the body but the line breaks are ignored in the body column of the table, how do I get the column to recognize the line breaks properly?

Thanks!
Best Answer chosen by Bill Woodson
Hengky IlawanHengky Ilawan
Try using outputText with escape attribute:
<apex:column><apex:outputText escape="false" value="{!YourNotesHere}" /></apex:column>

All Answers

kevin lamkevin lam
Have you tried using the pre tags? http://www.w3schools.com/Tags/tag_pre.asp
Bill WoodsonBill Woodson
I have not, I will try that now. Thanks!
Bill WoodsonBill Woodson
That only added those tags into the text see image...

User-added image
kevin lamkevin lam
I tried with the following VF page and it worked even without using the pre tags.

<apex:page standardController="Account">
<apex:pageBlock>
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!Account.Notes}" var="n">
<apex:column value="{!n.LastModifiedDate}"/>
<apex:column value="{!n.CreatedById}"/>
<apex:column value="{!n.Body}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>

User-added image
Hengky IlawanHengky Ilawan
Try using outputText with escape attribute:
<apex:column><apex:outputText escape="false" value="{!YourNotesHere}" /></apex:column>
This was selected as the best answer
Bill WoodsonBill Woodson
Thanks Hengky, that did it once I added a .replace('\n','<br/>') call into my class!

Thank you kevin too for your help!