I'm needed to copy some (not all!) items from rveSrc to rveTar. Is there simple way to make it?
I have write this method:
Code: Select all
procedure AssignRVData(Src, Tar: TCustomRVData);
var
i: Integer;
s: TCustomRVItemInfo;
t: TCustomRVItemInfo;
nc: TCustomRVItemInfoClass;
r: Integer;
c: Integer;
stii: TRVTableItemInfo;
ttii: TRVTableItemInfo;
begin
Tar.Clear;
for i := 0 to Src.ItemCount - 1 do
begin
s := Src.GetItem(i);
if s is TRVTableItemInfo then
begin
stii := s as TRVTableItemInfo;
ttii := TRVTableItemInfo.CreateEx(stii.RowCount, stii.ColCount, Tar);
ttii.Assign(stii);
ttii.AssignProperties(stii);
ttii.BestWidth := stii.Width;
Tar.AddItem('', ttii);
for r := 0 to stii.RowCount - 1 do
for c := 0 to stii.ColCount - 1 do
begin
AssignRVData(stii.Cells[r, c], ttii.Cells[r, c]);
ttii.Cells[r, c].AssignAttributesFrom(stii.Cells[r, c], True, 1, 1);
end;
end
else
begin
nc := TCustomRVItemInfoClass(s.ClassType);
t := nc.Create(Src);
t.Assign(s);
Tar.AddItem(s.ItemText, t);
end;
end;
end;
And then call its:
AssignRVData(rveSrc.RVData, rveTar.RVData);
rveTar.Format;
But it's does't work correct (there is some troubles with bullets and lists). Or if is straightforward way not exist, how I should to modify my code for make its work more correct?
Thanks!