DLR - RichEdit SLOW in getting attributes
I have another problem, when I scan thru all the text to get all the
attributes for all characters in a RichEdit, it can take quite some time
:( Especially if there is a bunch of text in there.
My problem is that MOST of the time, there are only a few places where
the text is not of the default attributes, but yet, I have to go thru
each character to get the attributes to see what they are.
Here's what I want to do. I want to take all bolded text and in my
output file stick keywords like {bold+} and {bold-} around text that is
bolded. And of course other formatting keywords as well. When I do:
For x:=1 to Lenght(rich1.text) do
begin
rich1.selstart:=x;
rich1.sellength:=1;
get the attributes and determine what to do
end;
This takes a bit of time. If I remove the
selstart/sellength/gettattributes logic, then it flows pretty fast. I
would think there should be a way of scanning for anything that is not
default attributes and find out the text ranges for them. But I can find
anythihng like that, it seems I have to interogate EVERY text position.
So, if my text was:
Have a NICE day
And the word "nice" was bold, using my logic, I would loop thru 15 times
looking at attributes to determine that the one word "nice" was bolded.
I would like to know if there is a function that returns a list of
textranges and their attributes. This would be faster.
Davie