I can not copy/paste from/to table cells

General TRichView support forum. Please post your questions here
Post Reply
jhonalone
Posts: 31
Joined: Mon Apr 07, 2008 5:59 pm
Location: Madrid

I can not copy/paste from/to table cells

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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 
jhonalone
Posts: 31
Joined: Mon Apr 07, 2008 5:59 pm
Location: Madrid

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, please make a video or other explanation and send to svt@trichview.com

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