on 07-16-2008 9:09 AM
Hi,
I need some inputs/pointers on this issue :
There is a webdynpro(ABAP) UI element Formattedtextedit which allows rich text to be added to a note .
When the data is saved and reopened and displayed in the same UI element ,the text is shown with the same features as it was entered (Bold/strong/header etc.) . But when the saved text is displayed in any other field (e.g. textedit) , the data is displayed with the entire tags , the same way as it was saved. Similarly , if the rich text is entered as a note and the same is sent via a mailing agent , the entire saved data is displayed with the tags .
Is there any existing API through which the text could be parsed before displaying the data in the two cases mentioned above?
Please provide us with some input/pointers on this issue.
Thanks and regards,
Abhay
Edited by: Abhay Sah on Jul 16, 2008 10:11 AM
Edited by: Abhay Sah on Jul 16, 2008 10:11 AM
Edited by: Abhay Sah on Jul 16, 2008 10:12 AM
I see that you are an SAP employee. Also you are asking questions about the formattedTextEditor, so you must be working on NetWeaver 7.1 or 7.0 Enhancement Package 1 since formattedTextEditor is not yet released for customers. It is probably more appropriate to ask quesitons about unreleased features in the SAP employees-only version of the Web Dynpro ABAP formum on SDN in the future.
The API for conversion of the formattedText is CL_WD_FORMATTED_TEXT. However there isn't method to strip the tags out. However removing tags can be done with one line of code using a greedy REGEX:
replace all occurrences of regex '<[^>]+>' in l_formatted_text with ``.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
Thanks for the inputs.
I have found a working solution .
Regards,
Abhay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
there is some functionality available that supports "rendering" a formatted text differently, e.g. as plain text:
You need to create a class that implements the interface IF_WD_FORMATTED_TEXT_RENDERER.
Just implement method RENDER_TEXT to extract the text. Use an instance of this class (plain_text_renderer) like this:
formatted_text = CL_WD_FORMATTED_TEXT=>CREATE( xml_text ).
formatted_text->render( plain_text_renderer ).
Best Regards,
Uwe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhay
I didn't find any API as such, you can make use of this code snippet for typical use
str is a formatted text
data: offset1 type i,
offset2 type i,
len type i,
line type i.
DATA: matcher TYPE REF TO cl_abap_matcher,
match TYPE match_result,
matches type MATCH_RESULT_TAB.
IF cl_abap_matcher=>contains( pattern = '>*</' text = str ) = abap_true.
matcher = cl_abap_matcher=>get_object( ).
match = matcher->get_match( ).
offset1 = match-offset.
ENDIF.
IF cl_abap_matcher=>contains( pattern = '>' text = str ) = abap_true.
matcher = cl_abap_matcher=>get_object( ).
matches = matcher->find_all( ).
loop at matches into match.
if match-offset > offset1.
exit.
endif.
offset2 = match-offset.
endloop.
ENDIF.
offset2 = offset2 + 1.
len = offset1 - offset2.
write: str+offset2(len).
Abhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.