Page 1 of 1

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

Posted: Tue Sep 02, 2014 9:54 am
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;

Posted: Tue Sep 02, 2014 4:31 pm
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.

Posted: Tue Sep 02, 2014 5:51 pm
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;

Posted: Wed Sep 03, 2014 9:59 am
by Sergey Tkachenko
Sorry, Cells[r,c] must be instead of Cell

Posted: Wed Sep 03, 2014 11:51 am
by j&b
Thank you.

Now it runs.