Forum > LCL

Converting TRichMemo content to HTML

(1/1)

egsuh:
Hasn't anybody know such a feature?   Supporting only bold, underline, and italic is sufficient.

Currently I'm using TMemo to get text input, and my web-server uses the content as part of HTML page. I copy a paragraph from word processor, e.g. MS-Word, which contain bolded words. But when I copy it into TMemo then all the font style definitions are gone.  If I'd like to make some words bold, I have to input <b> and </b> manually.

So I'm considering using TRichMemo instead of TMemo. I'm looking for a simple way.

I tested copying MS-Word paragraph into both TMemo and TRichMemo. In the attached image, the left one is TRichMemo, and the right one is TMemo.

paweld:
https://torry.net/files/apps/text/convert/rtf2html.zip

egsuh:
Thank you very much, paweld.  I'll review the codes.

Thaddy:
There is a better one, written by Marco Cantu, that compiles without change in {$mode delphi}.
The link above is to code that might have been useful for Delphi 1, but shows its age.
The code by Marco is also old, but much better designed and is still relevant.

paweld:
@Thaddy: I checked the code you shared in one of the threads, but it doesn't work "out of the box".
I also had the code shared by ruthjes@******.nl in my archive, which works, but unfortunately has a problem with UTF-8 characters.

Navigation

[0] Message Index

Go to full version