Page 1 of 1

I can not copy/paste from/to table cells

Posted: Sun Jan 03, 2010 3:47 pm
by jhonalone
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.

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;
Please, can you tell me if is it possible?
Or what's am I doing wrong.

Many Thanks.

Posted: Sun Jan 03, 2010 5:26 pm
by Sergey Tkachenko
I am not sure that I understand your code.
What is this line for?

Code: Select all

if EditorActivo.GetOffsAfterItem(EditorActivo.CurItemNo)=1 

Posted: Sun Jan 03, 2010 8:50 pm
by jhonalone
I want copy and paste exactly.

If any combination of text and paragraph not exist I create before paste and then apply, so that I get identical copy and paste into cell.

If I copy a paragraph into the cell whitout this code, the pasted text assume the same paragraph format existing into the cell.

I have a video working the editor. I can send it to you if you want to your private e-mail.

Thanks for your time.

Posted: Mon Jan 04, 2010 7:47 pm
by Sergey Tkachenko
Yes, please make a video or other explanation and send to [email protected]

Currently, I do not understand. All this functionality exists by default, so I do not know why you need additional code for copy-pasting.