VisualForce:将回车转换为长文本字段中的 html 换行符 [英] VisualForce: convert carriage returns to html line-breaks in a long text field
本文介绍了VisualForce:将回车转换为长文本字段中的 html 换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Salesforce 中,如果我将文本字段绑定到 VisualForce 页面,将文本字段中的回车符转换为 HTML <br/>
标签的好方法是什么?
In Salesforce, if I'm binding a text field into a VisualForce page, whats a good way to convert the carriage returns in the text-field into HTML <br/>
tags?
例如从这样的事情开始:
e.g. starting from something like this:
<apex:page standardController="Case">
<apex:pageBlock title="Test">
<p>{!case.Description}</p>
</apex:pageBlock>
<apex:detail relatedList="false" />
</apex:page>
...如果描述很长并且有很多回车符,我该如何 HTML 化它?
... if the Description is long with lots of carriage returns, how do I HTML-ify it?
(我想这是一个相当简单的问题,我相信我可以用谷歌搜索它,但为了让 Salesforce 社区继续下去,我认为我们需要一些简单的问题.)
(添加赏金以尝试激发一些兴奋)
推荐答案
试试这个:
<apex:outputField value="{!case.Description}"/>
使用输出字段将自动保持格式.
Using output fields will maintain formatting automagically.
这篇关于VisualForce:将回车转换为长文本字段中的 html 换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文