RTF and BackColor

General TRichView support forum. Please post your questions here
Post Reply
Marco
Posts: 2
Joined: Sat Feb 03, 2007 6:31 pm

RTF and BackColor

Post by Marco »

Hello

I want to export the contents of a TRichViewEdit into an RTF and then load the RTF into FastReport.

Everything works fine except that the BackColor-property of the text styles do not show in FastReport.

The strange thing is:
When I open the exported RTF in Word, the BackColor is there!! And when I simply save the same RTF from Word and THEN import it in FastReport, the background color is suddenly OK.

So what is the difference between an RTF directly exported from TRichViewEdit and an RTF that is "re-saved" in Word?

If I can just get the BackColor to export the same way as Word exports it, I will be happy.

Thanks for any suggestions!

Marco
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

FastReport uses standard RichEdit to display RTF objects. The standard RichEdit does not support many RTF features supported by MS Word and TRichView, they are lost when importing.
Marco
Posts: 2
Joined: Sat Feb 03, 2007 6:31 pm

Post by Marco »

Hi Sergey

Thanks for looking into it. After analyzing the RTF differences between RichView output and Word output I found a solution!

Microsoft uses the \highlight tag which is evidently interpreted correctly in FastReport. So now I use the SaveRTFExtra event of RichViewEdit to insert \highlight tags in the right positions. I do have to use a trick to make the whole thing work with the color table. But now it works like a charm! If anyone needs the code just contact me.

Keep up the great work on RichView!!!

Marco
Post Reply