Page 1 of 1

RTF and BackColor

Posted: Sat Feb 03, 2007 6:36 pm
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

Posted: Sun Feb 04, 2007 9:22 am
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.

Posted: Thu Feb 08, 2007 9:18 pm
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