WPCubed Product Support

Show content on Android Mobile.

Marcelo

I use Delphi DX10.1 Berlin

I have a field in a database, which is filled by a WPRichEdit by Client/Server application through a TText Stream.

Now I need to build a mobile application that reads this mentioned field.
Unfortunately the FMX library does not have a component for RichText, only a TMemo component.

This component loads text, however, it displays with their RTF "Tags" formatting characters, Trying to find a solution In this scenario I reached two alternatives:

First - Find a way to remove the RTF "tags" streams and display content over FMX memo.

Or

Second - Transforming TWPRichEdit RTF Tagas to the equivalent HTML Tags and display on a WebBorwser component.

Is there a simple solution to one of the above two alternatives?

#1 ♥ 0
7.3k Views 2 users read 2 min
support

1)

ansistring := WPRichText.AsAnsiString('ANSI')

2)

htmlstring := WPRichText.AsAnsiString('HTML')

Alternatively use SaveToStream( ..., format )

#2 ♥ 0
Marcelo

Ok but this solution above would work for average VCL application.

I mean, I need retrieve data previouly recorded on Database and show it in a new Android APP made with Firemonkey there is no TWPRichedit for Firemonkey yet.

Yes I can simple get it from stream from database easily but, it comes with all rtf formating.

Maybe a way to strip RTF format from string stream would work or transorm such formating onto HTML to present on mobile.
Thank you.

#3 ♥ 0
support

WPTools 7 contains a method which can strip the RTF tags. The procedure is also portable.

#4 ♥ 0
Marcelo

Thank you

I solved it with simple Regular Expression and rewrite memo content Twice

Regex.Create('({\\)(.+?)(})|(\\)(.+?)(\b)|}$');

#5 ♥ 0
This category is archived. No new posts are possible.