TENumStyles
TENumStyles Obtains a count of style runs in a range of text
#include <TextEdit.h> TextEdit
long TENumStyles(start, end, hTE );
long rangeStart range start (0 is start of all edit text)
long rangeEnd range end (past end is OK)
TEHandle hTE ; edit record of interest
returns a count of style changes across the range
The TENumStyles function returns the number of style changes contained in
the given range, counting one for the start of the range. Note that this number
does not necessarily represent the number of unique styles for the range
because some styles may be repeated. For unstyled edit records,
TENumStyles always returns 1.
TENumStyles returns the count of style changes ( including one for the
initial style) existing across the specified range. Use this to calculate the
amount of memory that will be needed in a large TECut or TECopy operation.
rangeStart and...
rangeEnd identify which text to examine.
hTE is a handle leading to an edit record created via TENew or
The rangeStart and rangeEnd parameters indicate the range. The text
containing the range is specified by the hTE parameter, a handle to the
edit record.
You can use TENumStyles to calculate the amount of memory that would be
required if TECut or TECopy were called. Since the style scrap record is
linear in nature, with one element for each style change, you can multiply the
result that TENumStyles returns by SizeOf(ScrpSTElement) and add 2 to get
the amount of memory needed.
Returns: a long integer; the number of style changes across the range.

Notes: The actual amount of memory used by styles in a Cut or Copy
operation will be the return value * sizeof(ScrpSTElement) +2.