TRVTableCellData.GetRVData

<< Click to display table of contents >>

TRVTableCellData.GetRVData

Returns object containing cell data (document items)

function GetRVData: TCustomRVData;

The cell is "an object containing data" itself. But when cell is in editing state, all its data are moved to inplace editor, and the cell is empty.

This method returns:

the cell itself, if it is not in editing state;

RVData property of inplace editor, otherwise.

So when working with content of cell directly, you can use this method and do not worry about editing state of a cell.

Example (retrieving text from table):

function GetTableText(table: TRVTableItemInfo): String;

var 

  i, r, c: Integer;

  RVData: TCustomRVData;

begin

  Result := '';

  for r := 0 to table.RowCount-1 do

  begin

    for c := 0 to table.ColCount-1 do

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

      begin

        RVData := table.Cells[r,c].GetRVData;

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

        begin

          if (i>0and RVData.IsFromNewLine(i) then

            Result := Result + #13#10;

          if RVData.GetItemStyle(i)=rvsTab then

            Result := Result + #9

           else if RVData.GetItemStyle(i)>=0 then

            Result := Result + RVData.GetItemText(i);

        end;

        Result := Result + table.TextColSeparator;

      end;

    Result := Result + table.TextRowSeparator;

  end;

end;

See also methods:

GetSourceRVData.