Show TOC Start of Content Area

Procedure documentation Implementing a SimpleFormattedTextField  Locate the document in its SAP Library structure

Use

SimpleFormattedTextFields can be inserted into a FormattedTextView in order to be able to bind parts of the text of a FormattedTextView to a context attribute.

Prerequisites

      You have inserted a FormattedTextViewelement in your view.

Procedure

...

       1.      To insert a SimpleFormattedTextField into the FormattedTextView, select the FormattedTextView in the Outline, click the secondary mouse button and choose Insert Field.

The following screenshot illustrates the Outline, containing a FormattedTextView with two SimpleFormattedTextFields inserted:

This graphic is explained in the accompanying text

       2.      Switch to the Properties view, select the name property of the SimpleFormattedTextField and enter Field. Confirm with ENTER.

       3.      To specify the position where the Field should be displayed in your FormattedTextView, insert the following tag: <field name="Field"/>.

       If you have bound the FormattedTextView to the context, you have to create a string containing this tag and create a FormattedText for it. The string could look something like this:

String value = "<p><h1>this is a header in format h1</h1></p>" +

               "<p><field name=\"Field\"/></p>" +

               "<h2>Just another header in format h2</h2>";

       Otherwise, select the text property of the FormattedTextView and choose This graphic is explained in the accompanying text. An editor opens. Here, you can insert this tag at the position where you want it to be displayed. In this example, it could look something like this:

This graphic is explained in the accompanying text

Result

The screenshot below shows how this FormattedTextView appears at runtime.

This graphic is explained in the accompanying text

See also:

Creating Formatted Text

End of Content Area