How can I mark the content of a 1-cell table (with all attributes) and place it in the clipboard (can be done with Ctrl + c)?
Subsequently, the content of the clipboard should be inserted again in another 1-cell table (can be done with Ctrl + v).
My experiments always show that in the 'other 1-cell' table not the content of the copied cell was inserted, but the 1-cell table with border lines.
[img]e:\copy 1-cell to another 1-cell-table.jpg[/img]
procedure TForm1.FokTabMarkClick (Sender: TObject);
begin
if Memo.GetItemStyle (memo.CurItemNo) = rvsTable then begin
//rveTable.Select(0,0,rveTable.rowCount-1,rveTable.colCount-1);
GetRveTabNo; // storedRveTabNo is the focused table
rveTable.SelectCols (0.1);
if MessageDlg ('Should the marked be deleted?',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
memo.deleteSelection;
SetRveTabNo; // so that marking is canceled
end;
end else ShowMessage ('No table was focused.');
end;
copy content from 1-cell-table to another 1-cell-table
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: copy content from 1-cell-table to another 1-cell-table
If you select a cell as a whole (or multiple cells), it will be copied to the clipboard as a table, and inserted as a table.
Unfortunately, the way of table pasting where content of pasted cells replaces content of selected cells is not implemented yet.
But you can select not a cell as a whole, but its content:
PS: GetItemStyle returns a table when the caret is before or after it. It does not return a table if the caret is inside its cells. I suggest using GetCurrentItemEx.
Unfortunately, the way of table pasting where content of pasted cells replaces content of selected cells is not implemented yet.
But you can select not a cell as a whole, but its content:
Code: Select all
rveTable.EditCell(0, 0);
rveTable.Cells[0, 0].GetRVData.SelectAll;
Re: copy content from 1-cell-table to another 1-cell-table
Thank you.
This runs now without border lines
procedure TForm1.FokusierteZelleMarkierenClick(Sender: TObject);
var RVData: TCustomRVData; //uses CRVData, CRVFData,
yNc: Integer;
begin
if Memo.GetItemStyle(memo.CurItemNo)=rvsTable then begin
RVData := rveTable.Cells[0,0];
RVData := RVData.Edit;
TCustomRVFormattedData(RVData).SelectAll;
clipboard.clear;
SendMessage(ActiveControl.Handle,WM_COPY,0,0);
yNc:= MessageDlg('Soll das Markierte erst kopiert und dann gelöscht werden ?'+#10+
'Einfügen lässt es sich überall über Strg+v.'+#10#10+
'Ja: Erst kopieren, dann löschen'+#10+
'Nein: Nur kopieren'+#10+
'Abbrechen: Nichts machen und Zwischenablage leeren'+#10#10,
mtConfirmation,[mbYes,mbNo,mbCancel],0);
if yNc= 2 then clipboard.clear
else if yNc= 6 then memo.deleteSelection;
rveTable.EditCell(0,0); //Markierung aufheben
end else ShowMessage('Es wurde keine Tabelle fokusiert.');
end;
This runs now without border lines
procedure TForm1.FokusierteZelleMarkierenClick(Sender: TObject);
var RVData: TCustomRVData; //uses CRVData, CRVFData,
yNc: Integer;
begin
if Memo.GetItemStyle(memo.CurItemNo)=rvsTable then begin
RVData := rveTable.Cells[0,0];
RVData := RVData.Edit;
TCustomRVFormattedData(RVData).SelectAll;
clipboard.clear;
SendMessage(ActiveControl.Handle,WM_COPY,0,0);
yNc:= MessageDlg('Soll das Markierte erst kopiert und dann gelöscht werden ?'+#10+
'Einfügen lässt es sich überall über Strg+v.'+#10#10+
'Ja: Erst kopieren, dann löschen'+#10+
'Nein: Nur kopieren'+#10+
'Abbrechen: Nichts machen und Zwischenablage leeren'+#10#10,
mtConfirmation,[mbYes,mbNo,mbCancel],0);
if yNc= 2 then clipboard.clear
else if yNc= 6 then memo.deleteSelection;
rveTable.EditCell(0,0); //Markierung aufheben
end else ShowMessage('Es wurde keine Tabelle fokusiert.');
end;