Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Servers
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 27-11-2006
trygvekor trygvekor is offline
Registrado
 
Registrado: ago 2006
Posts: 8
Poder: 0
trygvekor Va por buen camino
Copiar y pegar

Hola, te paso dos procedimientos que hacen lo que necesitas, si bien no estan hechas para que trabajen sobre la planilla de excel, puedes adaptar el codigo facilmente para que lo haga(estan hechas sobre un stringgrid). Yo utilizo un stringgrid auxiliar, pero mas que nada lo puse para poder verificar los datos.

procedure TForm1.CopiarCortarSel(borrar:bool);
var
i,j:integer;
RecCopiar:TGridRect;
begin
RecCopiar:=stringgrid1.Selection;
stringgrid2.ColCount:=RecCopiar.Right-RecCopiar.Left+2;
stringgrid2.rowCount:=RecCopiar.Bottom-RecCopiar.Top+2;
for i:=1 to (stringgrid2.ColCount-1) do
begin
for j:=1 to (stringgrid2.RowCount-1)do
begin
stringgrid2.Cells[i,j]:=stringgrid1.Cells[i+RecCopiar.Left-1,j+RecCopiar.top-1];
if borrar then stringgrid1.Cells[i+RecCopiar.Left-1,j+RecCopiar.top-1]:='';
end;
end;
end;

procedure TForm1.PegarSel;
var
i,j: integer;
begin
for i:=stringgrid1.Col to (Stringgrid1.Col+stringgrid2.ColCount-2) do
begin
for j:=stringgrid1.Row to (Stringgrid1.Row+stringgrid2.rowCount-2)do
begin
stringgrid1.Cells[i,j]:=stringgrid2.Cells[i+1-stringgrid1.Col,j+1-stringgrid1.Row]
end;
end;
end;


lo que tienes que modificar es en donde dice stringgrid1.cells[x,y] poner worksheet.Cells.Item[x,y] o algo similar. Suerte

Es mi primer colaboracion en un foro, asi que si te sirvio me gustaria que lo digas asi lo sigo haciendo.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 02:20:04.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi