Page 1 of 1

Newbie Font Color Questions

Posted: Sun Oct 26, 2008 1:46 pm
by GRGirl
When I read in an existing RTF file font colors are changed. For instance a heading in black may become blue, or some italic text in black may become red. Since every file may be different I don't want to hard code in colors. How do I fix it so existing file text is not changed?

Also, I set up my own TextStyle. If I add some initial header text to a document with my own TextSyle font, the rest of the document headers also use this font. How do I fix this?

Sincere apologies for bothering you with newbie questions. I am obviously missing where this info is in the help file.

Thank you.

Posted: Sun Oct 26, 2008 5:57 pm
by Sergey Tkachenko
There are several modes for reading formatting from RTF files.
As I understand, in your application "Use Closest" mode is used: no new styles are added when reading RTF, only existing styles are used.
For the best results, "Add if needed" mode must be used instead.
These modes are defined in rv.RTFReadProperties.TextStyleMode and rv.RTFReadProperties.ParaStyleMode properties. Set them both to rvrsAddIfNeeded.

For components placed on form at design time it must be by default. Right click TRichView/TRichViewEdit in Delphi, choose "Settings" in the popup menu, make sure that "Allow adding styles dynamically" is selected.

Posted: Sun Oct 26, 2008 6:43 pm
by GRGirl
That fixed my problem. Many thanks! And thank you for the very prompt help.