Hi
What is the easiest way to know how many colors there are in the text of a dbrichviewedit?
For example:
"This is the text in a dbdrichviewedit]" -> The result is three (black, red and blue)
Thanks in advance
Colours in dbrichviewedit text
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
TextStyles actually represent formatting of text, not real styles (real styles are called StyleTemplates, and they are optional).
TextStyles contain information about attributes of all text. There can be only one problem: some styles may be unused (no text item uses them).
For DBRichViewEdit, it is HIGHLY recommended to set AutoDeleteUnusedStyles=True, so that unused styles are deleted when a new document is created.
You can call DeleteUnusedStyles(True, True, True) before enumerating colors, it will delete unused styles. However, this method clears undo buffer as well.
Another problem: DeleteUnusedStyles does not delete styles having property Standard=True. To solve this problem, delete at design time all RVStyle.TextStyles and RVStyle.ParaStyles, except the first item in the collection.
TextStyles contain information about attributes of all text. There can be only one problem: some styles may be unused (no text item uses them).
For DBRichViewEdit, it is HIGHLY recommended to set AutoDeleteUnusedStyles=True, so that unused styles are deleted when a new document is created.
You can call DeleteUnusedStyles(True, True, True) before enumerating colors, it will delete unused styles. However, this method clears undo buffer as well.
Another problem: DeleteUnusedStyles does not delete styles having property Standard=True. To solve this problem, delete at design time all RVStyle.TextStyles and RVStyle.ParaStyles, except the first item in the collection.