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.
Newbie Font Color Questions
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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.
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.