Board index » delphi » Several questions about RTF component

Several questions about RTF component

Hello, all.

I have several questions about RTF component:

-Is there any way to know if the text in the RTF component
 is enriched or is only text plain? (the user has put formats
 in the text)

-When I get one line of enriched text of the component with
 RTF.lines[x] I get the plain text although the line be RTF text.
 If I save with RTF.Lines.SaveToFile I get the enriched text
 in the file. How can I get the RTF text getting the line with
 RTF.lines[x]?

-How could I translate RTF text to HTML?

Please, email me to Agustin.Lo...@uv.es

Best regards,
Agustin

--
              ===============================
              |  Jose Agustin Lopez Bueno   |
              | E-Mail: Agustin.Lo...@uv.es |
              |                             |
              |  http://www.uv.es/~lopezj/  |  
              |                             |
              |     Tel: +34-6-3864310      |
              |     Fax: +34-6-3864200      |
              |   Servicio de Informatica   |
              |   Universidad de Valencia   |
              ===============================

 

Re:Several questions about RTF component


lop...@iluso.ci.uv.es (Agustin Lopez Bueno) wrote:

Quote
>I have several questions about RTF component:
>-Is there any way to know if the text in the RTF component
> is enriched or is only text plain? (the user has put formats
> in the text)

The TRichEdit is mainly intended as a interactive control and as such
there are no ways to check directly what attributes text has. However,
at least these two solutions can be used:

1. change the cursor position to the character/paragraph you want to
examine and then use the SelAttribute/Paragraph properties.

2. Save the RTF data to a file and the parse it yourself.

Of those two, I'd recommended the first.

Quote
>-When I get one line of enriched text of the component with
> RTF.lines[x] I get the plain text although the line be RTF text.
> If I save with RTF.Lines.SaveToFile I get the enriched text
> in the file. How can I get the RTF text getting the line with
> RTF.lines[x]?

You have to save the text to a file, and then read the Nth line.

Quote
>-How could I translate RTF text to HTML?

You have to do the conversion yourself.

Regards,

Jani J?rvinen
a.k.a SilverStream Software
Helsinki Finland
mailto:ja...@dystopia.fi
http://www.dystopia.fi/~janij/

Other Threads