The FormattedText control allows the usage of a limited set of tags for inline display of formatted text in HTML format.
Constructor for a new FormattedText.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.
new sap.m.FormattedText(sId?, mSettings?)
Param | Type | Default Value | Description |
---|---|---|---|
sId? | string | ID for the new control, generated automatically if no ID is given |
|
mSettings? | object | Initial settings for the new control |
Name | Type | Default Value | Description |
---|---|---|---|
convertLinksToAnchorTags | sap.m.LinkConversion | None | Determines whether strings that appear to be links will be converted to HTML anchor tags, and what are the criteria for recognizing them. |
convertedLinksDefaultTarget | string | _blank | Determines the Note: Applicable only if |
height | sap.ui.core.CSSSize | Optional height of the control in CSS units. Visibility: public |
|
htmlText | string | empty string | Text in HTML format. The following tags are supported:
Only safe Note: Keep in mind that not supported HTML tags and the content nested inside them are both not rendered by the control. Visibility: public |
textAlign | sap.ui.core.TextAlign | Begin | Determines the text alignment in the text elements in the Note: This functionality if set to the root element. To set explicit alignment to an element use the |
textDirection | sap.ui.core.TextDirection | Inherit | Defines the directionality of the text in the Note: This functionality if set to the root element. Use the |
width | sap.ui.core.CSSSize | Optional width of the control in CSS units. Visibility: public |
Default Aggregation:
Name | Cardinality | Type | Description |
---|---|---|---|
controls | 0..n | sap.m.Link |
List of |
Method | Description |
---|---|
_setUseLimitedRenderingRules |
Sets should a limited list of rendering rules be used instead of the default one. This limited list will evaluate only a small subset of the default HTML elements and attributes. |
addControl |
Adds some control to the aggregation controls. |
destroyControls |
Destroys all the controls in the aggregation controls. |
sap.m.FormattedText.extend |
Creates a new subclass of class sap.m.FormattedText with name
|
getControls |
Gets content of aggregation controls. List of |
getConvertedLinksDefaultTarget |
Gets current value of property convertedLinksDefaultTarget. Determines the Note: Applicable only if Default value is |
getConvertLinksToAnchorTags |
Gets current value of property convertLinksToAnchorTags. Determines whether strings that appear to be links will be converted to HTML anchor tags, and what are the criteria for recognizing them. Default value is |
getHeight |
Gets current value of property height. Optional height of the control in CSS units. |
getHtmlText |
Gets current value of property htmlText. Text in HTML format. The following tags are supported:
Only safe Note: Keep in mind that not supported HTML tags and the content nested inside them are both not rendered by the control. Default value is |
sap.m.FormattedText.getMetadata |
Returns a metadata object for class sap.m.FormattedText. |
getTextAlign |
Gets current value of property textAlign. Determines the text alignment in the text elements in the Note: This functionality if set to the root element. To set explicit alignment to an element use the Default value is |
getTextDirection |
Gets current value of property textDirection. Defines the directionality of the text in the Note: This functionality if set to the root element. Use the Default value is |
getWidth |
Gets current value of property width. Optional width of the control in CSS units. |
indexOfControl |
Checks for the provided |
insertControl |
Inserts a control into the aggregation controls. |
removeAllControls |
Removes all the controls from the aggregation controls. Additionally, it unregisters them from the hosting UIArea. |
removeControl |
Removes a control from the aggregation controls. |
setConvertedLinksDefaultTarget |
Sets a new value for property convertedLinksDefaultTarget. Determines the Note: Applicable only if When called with a value of Default value is |
setConvertLinksToAnchorTags |
Sets a new value for property convertLinksToAnchorTags. Determines whether strings that appear to be links will be converted to HTML anchor tags, and what are the criteria for recognizing them. When called with a value of Default value is |
setHeight |
Sets a new value for property height. Optional height of the control in CSS units. When called with a value of |
setHtmlText |
Defines the HTML text to be displayed. |
setTextAlign |
Sets a new value for property textAlign. Determines the text alignment in the text elements in the Note: This functionality if set to the root element. To set explicit alignment to an element use the When called with a value of Default value is |
setTextDirection |
Sets a new value for property textDirection. Defines the directionality of the text in the Note: This functionality if set to the root element. Use the When called with a value of Default value is |
setWidth |
Sets a new value for property width. Optional width of the control in CSS units. When called with a value of |
Sets should a limited list of rendering rules be used instead of the default one. This limited list will evaluate only a small subset of the default HTML elements and attributes.
Param | Type | DefaultValue | Description |
---|---|---|---|
bLimit | boolean |
Should the control use the limited list |
Adds some control to the aggregation controls.
Param | Type | DefaultValue | Description |
---|---|---|---|
oControl | sap.m.Link |
The control to add; if empty, nothing is inserted |
Creates a new subclass of class sap.m.FormattedText with name sClassName
and enriches it with the information contained in oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.core.Control.extend.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Gets content of aggregation controls.
List of sap.m.Link
controls that will be used to replace the placeholders in the text. Placeholders are replaced according to their indexes. The placeholder with index %%0 will be replaced by the first link in the aggregation, etc.
Gets current value of property convertedLinksDefaultTarget.
Determines the target
attribute of the generated HTML anchor tags.
Note: Applicable only if ConvertLinksToAnchorTags
property is used with a value other than sap.m.LinkConversion.None
. Options are the standard values for the target
attribute of the HTML anchor tag: _self
, _top
, _blank
, _parent
, _search
.
Default value is "_blank"
.
Gets current value of property convertLinksToAnchorTags.
Determines whether strings that appear to be links will be converted to HTML anchor tags, and what are the criteria for recognizing them.
Default value is None
.
Gets current value of property htmlText.
Text in HTML format. The following tags are supported:
a
abbr
bdi
blockquote
br
cite
code
em
h1
h2
h3
h4
h5
h6
p
pre
strong
span
u
dl
dt
dd
ul
ol
li
class, style, dir,
and target
attributes are allowed. If target
is not set, links open in a new window by default.
Only safe href
attributes can be used. See URLListValidator.
Note: Keep in mind that not supported HTML tags and the content nested inside them are both not rendered by the control.
Default value is empty string
.
Gets current value of property textAlign.
Determines the text alignment in the text elements in the FormattedText
.
Note: This functionality if set to the root element. To set explicit alignment to an element use the style
attribute.
Default value is Begin
.
Gets current value of property textDirection.
Defines the directionality of the text in the FormattedText
, e.g. right-to-left(RTL
) or left-to-right (LTR
).
Note: This functionality if set to the root element. Use the bdi
element and the dir
attribute to set explicit direction to an element.
Default value is Inherit
.
Checks for the provided sap.m.Link
in the aggregation controls. and returns its index if found or -1 otherwise.
Param | Type | DefaultValue | Description |
---|---|---|---|
oControl | sap.m.Link |
The control whose index is looked for |
Inserts a control into the aggregation controls.
Param | Type | DefaultValue | Description |
---|---|---|---|
oControl | sap.m.Link |
The control to insert; if empty, nothing is inserted |
|
iIndex | int |
The |
Removes all the controls from the aggregation controls.
Additionally, it unregisters them from the hosting UIArea.
Removes a control from the aggregation controls.
Param | Type | DefaultValue | Description |
---|---|---|---|
vControl | int string sap.m.Link |
The control to remove or its index or id |
Sets a new value for property convertedLinksDefaultTarget.
Determines the target
attribute of the generated HTML anchor tags.
Note: Applicable only if ConvertLinksToAnchorTags
property is used with a value other than sap.m.LinkConversion.None
. Options are the standard values for the target
attribute of the HTML anchor tag: _self
, _top
, _blank
, _parent
, _search
.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is "_blank"
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sConvertedLinksDefaultTarget | string | "_blank" |
New value for property |
Sets a new value for property convertLinksToAnchorTags.
Determines whether strings that appear to be links will be converted to HTML anchor tags, and what are the criteria for recognizing them.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is None
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sConvertLinksToAnchorTags | sap.m.LinkConversion | None |
New value for property |
Sets a new value for property height.
Optional height of the control in CSS units.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sHeight | sap.ui.core.CSSSize |
New value for property |
Defines the HTML text to be displayed.
Param | Type | DefaultValue | Description |
---|---|---|---|
sText | string |
HTML text as a string |
Sets a new value for property textAlign.
Determines the text alignment in the text elements in the FormattedText
.
Note: This functionality if set to the root element. To set explicit alignment to an element use the style
attribute.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Begin
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sTextAlign | sap.ui.core.TextAlign | Begin |
New value for property |
Sets a new value for property textDirection.
Defines the directionality of the text in the FormattedText
, e.g. right-to-left(RTL
) or left-to-right (LTR
).
Note: This functionality if set to the root element. Use the bdi
element and the dir
attribute to set explicit direction to an element.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Inherit
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sTextDirection | sap.ui.core.TextDirection | Inherit |
New value for property |
Sets a new value for property width.
Optional width of the control in CSS units.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sWidth | sap.ui.core.CSSSize |
New value for property |