trichview.com

trichview.support




Re: Character count?


Return to index


Author

Message

Sergey Tkachenko

Posted: 06/01/2002 18:12:06


The function below returns a number of characters (including characters in

tables):


uses CRVData, RVTable;


function GetCharCount(RVData: TCustomRVData): Integer;

var i,r,c: Integer;

    table: TRVTableItemInfo;

begin

  Result := 0;

  for i := 0 to RVData.Items.Count-1 do

    if RVData.GetItemStyle(i)>=0 then

      inc(Result, RVData.ItemLength(i))

    else if RVData.GetItemStyle(i)=rvsTable then begin

      table := TRVTableItemInfo(RVData.GetItem(i));

      for r := 0 to table.Rows.Count-1 do

        for c := 0 to table.Rows[r].Count-1 do

          if table.Cells[r,c]<>nil then

            inc(Result, GetCharCount(table.Cells[r,c].GetRVData))

    end;

end;


call: GetCharCount(RichViewEdit1.RVData);


This function does not include in the result:

- non-text items, such as images

- carriage returns



>   Isn't there any way to get character count ?

>

>





Powered by ABC Amber Outlook Express Converter