I can not copy/paste from/to table cells
Posted: Sun Jan 03, 2010 3:47 pm
I have a RichView Editor working well, but not inside tables.
I can copy and paste selected texts using CopyDef function.
But it is not possible when I try to copy selected text on table cells. If there is something copied at clipboard before, you can not copy other selected text from cell to clipboard.
If I try to copy the selected text from other paragraph of the document into other paragraph inside cell, the format of cell paragraph change format to centered text, which is the format of the fist cell of the table.
I do not understand the reason.
Please, can you tell me if is it possible?
Or what's am I doing wrong.
Many Thanks.
I can copy and paste selected texts using CopyDef function.
But it is not possible when I try to copy selected text on table cells. If there is something copied at clipboard before, you can not copy other selected text from cell to clipboard.
If I try to copy the selected text from other paragraph of the document into other paragraph inside cell, the format of cell paragraph change format to centered text, which is the format of the fist cell of the table.
I do not understand the reason.
Code: Select all
{ Edit|Copy -----------------------------------------------------------}
procedure TFormUnidad1.mitCopyClick(Sender: TObject);
var
StartItemNo, StartItemOffs:integer;
EndItemNo, EndItemOffs:integer;
CurItemNo, OffsetCurItemNo:integer;
SBVpos,SBHpos:integer;
begin
//Obtenemos coordenadas de la seleccion
EditorActivo.GetSelectionBounds(StartItemNo,StartItemOffs,EndItemNo,EndItemOffs,True);
//Obtenemos la posiciĆ³n de las barras de desplazamiento
SBVpos:=EditorActivo.VScrollpos;
SBHpos:=EditorActivo.HScrollpos;
//Antes de salvar estilos colocamos el cursor al inicio de seleccion
//Esto deshace la seleccion
EditorActivo.SetSelectionBounds(StartItemNo,StartItemOffs,StartItemNo,StartItemOffs);
//Obtenemos los estilos de texto y parrafo actual
EstiloPrimParrafo.Assign(EditorActivo.Style.ParaStyles[EditorActivo.CurParaStyleNo]);
//Restablecemos la selecccion (el cursor pasa al final de la seleccion siempre)
EditorActivo.SetSelectionBounds(StartItemNo,StartItemOffs,EndItemNo,EndItemOffs);
//Restablecemos la posicion las barras de desplazamiento
EditorActivo.VScrollpos:=SBVpos;
EditorActivo.HScrollpos:=SBHpos;
EditorActivo.CopyDef;
EditorActivo.Deselect;
end;
{ Edit|Paste ----------------------------------------------------------}
procedure TFormUnidad1.mitPasteClick(Sender: TObject);
var
NewParaNo:integer;
begin
if EditorActivo.GetOffsAfterItem(EditorActivo.CurItemNo)=1
then begin
NewParaNo:=EditorActivo.Style.ParaStyles.FindSuchStyle(EditorActivo.CurParaStyleNo,EstiloPrimParrafo,RVAllParaInfoProperties);
if NewParaNo = -1 //si no existe igual, lo creamos
then begin
EditorActivo.Style.ParaStyles.Add.Assign(EstiloPrimParrafo);
NewParaNo:=EditorActivo.Style.ParaStyles.Count-1;
end;
EditorActivo.ApplyParaStyle(NewParaNo);
end;
EditorActivo.Paste;
end;
Or what's am I doing wrong.
Many Thanks.