trichview.com

trichview.support.examples




Example: character count


Return to index


Author

Message

Sergey Tkachenko

Posted: 11/08/2004 22:30:40


uses CRVData, RVTable;


function GetCharCount(RVData: TCustomRVData): Integer;

var i,r,c,StyleNo: Integer;

    table: TRVTableItemInfo;

begin

  Result := 0;

  for i := 0 to RVData.ItemCount-1 do

  begin

    StyleNo := RVData.GetItemStyle(i);

    if StyleNo>=0 then

      inc(Result, RVData.ItemLength(i))

    else if StyleNo=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;

end;


Call:


r := GetCharCount(RichView1.RVData);





Powered by ABC Amber Outlook Express Converter