I searched the two funcitons.
I create my funcitons base on them.
The detail is as below.
Code: Select all
procedure TForm1.bSaveClick(Sender: TObject);
var s: String;
begin
s := trim(GetFieldValue2(srv.RichViewEdit, 'eName5'));
showmessage('»бХпјЗВјЎѕ'+s+'Ўї±ЈґжіЙ№¦ЈЎ');
end;
Code: Select all
function GetFieldValue2(rv: TCustomRichView; const field: String): String;
var ItemNo: Integer;
    RVData: TCustomRVData;
    ItemNoStr :string;
    i:integer;
begin
  Result:='';
  if GetFieldLocation2(rv.RVData, field, RVData, ItemNo,ItemNoStr) then begin
      for i:=1 to X_Arrcount do
      begin
        Result :=Result+ RVData.GetRVData.GetItemText(aOrg[i]);
      end;
    end
  else
    Result := 'error';
end;
Code: Select all
function GetFieldLocation2(RootRVData: TCustomRVData; const field: String;
                           var RVData: TCustomRVData;
                           var ItemNo: Integer;
                           var strItemNo:string): Boolean;
var i,j,r,c: Integer;
    table: TRVTableItemInfo;
begin
  X_Arrcount:=0;
  Result := False;
  strItemNo:='';
  for i := 0 to RootRVData.ItemCount-1 do
    if RootRVData.GetItemStyle(i)=rvsTable then begin
      table := TRVTableItemInfo(RootRVData.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 begin
             for j:=0 to table.Cells[r,c].GetRVData.ItemCount-1 do
             begin
                if PChar(table.Cells[r,c].GetRVData.GetItemTag(j)) = field then begin
                inc(X_Arrcount);
                ItemNo := j;
                aOrg[X_Arrcount]:=j;
                strItemNo:=strItemNo+inttostr(ItemNo)+',';
                RVData := table.Cells[r,c].GetRVData.GetSourceRVData;
                Result := True;
               // exit;
                end;
             end;
          end
      end;
  if Result then
  strItemNo:=copy(strItemNo,1,length(strItemNo)-1)
  else
   strItemNo:='xxx';
end;
But another new problem ?
If I save the "eName5" tags's values as user's input format.
when the user read the data,how I read the data from database to the "eName5" tag as user input format?
I only create one "eName5" tag on the even of form create.
How I write the data to the "eName5" tag?
Please help me.
Thanks
 and the procedure(procedure ChangeFieldValue(RVData: TCustomRVData;
 and the procedure(procedure ChangeFieldValue(RVData: TCustomRVData;