trichview.com

trichview.support




Re: FieldsCount


Return to index


Author

Message

Sergey Tkachenko

Posted: 04/21/2005 22:03:04


function TForm1.GetFieldCount(RVData: TCustomRVData; const FieldName:

String): Integer;

var i,r,c: Integer;

    table: TRVTableItemInfo;

begin

  Result := 0;

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

    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, GetFieldsCount(table.Cells[r,c].GetRVData));

    end

    else if (RVData.GetItemStyle(i)>=0) and (rvprModifyProtect in

       RVData.GetRVStyle.TextStyles[RVData.GetItemStyle(i)].Protection) and

      (PChar(RVData.GetItemTag(i))=FieldName) then

      inc(Result);

end;


(this code can be used in the demo

http://www.trichview.com/support/files/mailmerge-freestyle.zip)


>

> I Want the number of occurences of field with the given name !

>

> how I make?





Powered by ABC Amber Outlook Express Converter