For example: If I have a document that has two words in different parts of the document that are bolded; Is there an easy way to get a count of how many times the bold style was used in the document?
any way to count number of times a style is used?
-
-
- Offizieller Beitrag
Sure:
CPPosition := 0;
count := 0;repeat
if afsBold in CPAttr.Style then inc(count);
until not CPMoveNext;Julian
-
I'll give that a shot. Thanks!
-
This works but it counts each letter as 1.
So the word bold counts as 4 where if it is the only word that is bold in the document, it should count as just one. If there was another word that was bold somewhere in the document the count would be two.
I'm trying to do something like this but not working yet.
Codecount := 0; With WPRichText1 do begin CPPosition := 0; repeat if afsBold in CPAttr.Style then inc(count); repeat CPMoveNext; until NOT afsBold in CPAttr.Style; until not CPMoveNext; end;
Is this possible?
-