cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting text in Interactive form

thomasnelissen
Participant
0 Kudos

Dear experts,

We have an ABAP webdynpro application which uses a WYSIWYG editor to save a piece of text in HTML format to the database.

This text needs to be outputted in an interactive form. Right now our form is showing all the HTML tags. Is there any way to apply the (basic) HTML formatting in the interactive form?

Thanks in advance!

Thomas Nelissen

Accepted Solutions (1)

Accepted Solutions (1)

thomasnelissen
Participant
0 Kudos

I found the solution on this blog: http://blog.pandyaparth.com/?p=65

The field format of the text field needs to be set to "Rich Text"

In the "Value" tab of the text field, select "Calculated - read only" as Type.

After this you need to paste the following javascript code in the initialize event of your text field:

this.value.exData.loadXML('<body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">'+$record.CONTEXT_PARAMETER.value+'</body>');

CONTEXT_PARAMETER is the name of the context field that contains HTML.

Only the following HTML tags are supported:

  • A
  • B
  • BR
  • BODY
  • HTML
  • I
  • P
  • SPAN
  • SUB
  • SUP

You can use these HTML-tags in combination with CSS to format your text.

More info on formatting text with HTML/CSS in interactive forms can be found in this document:

http://partners.adobe.com/public/developer/en/xml/xfa_spec_3_3.pdf

(Part 3: Other XFA-Related References => Rich Text Reference)

IvanAlonsoBes
Explorer

Hi

I needed this for adobe fragments in the output scenario but Thomas solutions applies as well.

Something like this sample code t in the initialize event of your text field using javascript (remember to set the field as rich text as stated by Thomas almost 10 years ago 🙂 )

// gather data from context for footer

var lv_data = xfa.resolveNode("$record.FormMaster.Footer.FooterBlock1Text").value;

//this.rawValue = "test"+lv_data;

// render in html into a rich text text field this.value.exData.loadXML('<body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">'+lv_data+'</body>');

or in one line:

this.value.exData.loadXML('<body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">'+$record.FormMaster.Footer.FooterBlock1Text.value+'</body>');

Here we are rendiering some texts in a text configured as footer for master page (manage my texts app) in footer area of the master page template form. Our context is from root node navigate to FormMaster then Footer then FooterBlock1Text ($record.FormMaster.Footer.FooterBlock1Text)

This part I didn't found self explanatory from Thomas post

Regarding output carry returns are skipped and you will need to add <br/> to each line in the manage text app text

For bold characters as stated by Thomas use <b> text </b>

Answers (0)