Copy content of a cell to another cell of the same table

General TRichView support forum. Please post your questions here
Post Reply
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Copy content of a cell to another cell of the same table

Post by j&b »

Hello,

I want to copy the cell-content (text with attributes) without marking to clipbord. Then I want to insert clipboard-text into a selected cell of the same / other table.

My solution is not satisfactory:
- rveTable.Select(r,c,0,0); //copies cell-borderline too
- memo.selectCurrentLine; //copies only the first line (the currentline)

What is to do to copy cell to cell (content is text with attributes or rotated text or images ....)


procedure TForm1.Zellinhaltkopieren1Click(Sender: TObject);
begin
if (memo.GetCurrentItemEx(TRVTableItemInfo, rve, TCustomRVItemInfo(rveTable))) then begin
rveTable.GetEditedCell(rveTzeile1,rveTspalte1);
if rveTable.Cells[rveTzeile1,rveTspalte1]<>nil then rveTable.Select(rveTzeile1,rveTspalte1,0,0);
end;

//memo.selectCurrentLine;
memo.copyDef;
rveTable.deselect;
end;

procedure TForm1.KopiertenZellinhalteinfgen1Click(Sender: TObject);
begin
SendMessage(ActiveControl.Handle,WM_PASTE,0,0);
end;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can copy either a cell content or a cell itself.
Unfortunately, if you copy a cell, it can be inserted only as a new 1x1 table.
If you copy cell content, you copy only content, but not cell attributes (like cell color or rotation).

If selecting is ok, you can do it by:

rveTable.EditCell(r,c);
TCustomRVFormattedData(rveTable.Cell.GetRVData).SelectAll;

This method selects the whole cell content.
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

First, thanks for your help. But ...

Program stopps at

TCustomRVFormattedData(rveTable.Cell.GetRVData).SelectAll;

--> (cell) unknown identifiers (Bezeichner)

I don't find cell (only cells) in the help.

What's to do ?

Jürgen



procedure TForm1.Zellinhaltkopieren1Click(Sender: TObject);
var RVData: TCustomRVData;
begin
if (memo.GetCurrentItemEx(TRVTableItemInfo, rve, TCustomRVItemInfo(rveTable))) then begin
rveTable.GetEditedCell(rveTzeile1,rveTspalte1);
TCustomRVFormattedData(rveTable.Cell.GetRVData).SelectAll;
end;
memo.copyDef;
rveTable.deselect;
end;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, Cells[r,c] must be instead of Cell
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Thank you.

Now it runs.
Post Reply