trichview.com

trichview.support




Re: Table rows cloning...


Return to index


Author

Message

Sergey Tkachenko

Posted: 09/03/2004 18:36:48


Hi,


The simplest code is


procedure DuplicateLastRow(table: TRVTableItemInfo; Count: Integer);

var i: Integer;

    Stream: TMemoryStream;

begin

  Stream := TMemoryStream.Create;

  table.SaveRowsToStream(Stream, table.Rows.Count-1, 1);

  table.InsertRows(table.Rows.Count, Count, table.Rows.Count-1, False);

  for i := 1 to Count do

  begin

    Stream.Position := 0;

    table.LoadFromStreamEx(Stream, table.Rows.Count-i);

  end;

  Stream.Free;

end;


It uses some undocumented methods.

If this operation should be undoable, some additional code is required,





Hi.

I use TRichViewEdit as reporting tool...


Is there any simple way to clone last row of the table?

For example: a have table with 2 rows - first is a header and I want to

have finally table with 11 rows, one for this header and then 10 times

second row.

(This second row can have very complicated structure, eg.: pictures or

subtables in its cells).

I will be pleased for some advices.


Sebastian Gąsior





Powered by ABC Amber Outlook Express Converter