FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
||||
|
||||
Pegar de Clipboard a StringGrid
var
Vtextbuf:string; Vnren:integer; columna:integer; begin if Clipboard.HasFormat(CF_TEXT) then begin Vtextbuf:= Clipboard.AsText; Vnren:=1; stringgrid1.RowCount:=2; columna:=strtoint(edit1.text); while (pos(#13,Vtextbuf)>0)and(length(Vtextbuf)>2) do begin stringgrid1.Cells[Columna,Vnren]:=copy(Vtextbuf,1,pos(#13,Vtextbuf)-1); delete(Vtextbuf,1,pos(#13#10,Vtextbuf)+1); if (length(Vtextbuf)>2) then begin stringgrid1.RowCount:=stringgrid1.RowCount+1; Vnren:=Vnren+1; end; // ShowMessage(Vtextbuf); end; bt_validar.Click; end else ShowMessage('No hay texto en el PortaPapeles'); Este Codigo me entrega lo copiado pero no el ultimo valor que puede ser? |
#2
|
||||
|
||||
Bienvenido a clubdelphi, ¿ya leiste nuestra guía de estilo?, gracias por tu colaboración
Recuerda poner los tags al código fuente, ejemplo: Gracias |
#3
|
||||
|
||||
Hola Cristhor1982.
Si no interpreté mal la finalidad del código, yo haría:
Saludos.
__________________
Daniel Didriksen Guía de estilo - Uso de las etiquetas - La otra guía de estilo .... |
#4
|
||||
|
||||
Cristhor1982,
Revisa este código: El código anterior permite copiar por medio del Clipboard filas y columnas de data desde y hacia un control TStringGrid, es práctico para el intercambio de data con Excel. Espero sea útil Nelson. Última edición por nlsgarcia fecha: 08-12-2012 a las 03:22:55. |
#5
|
||||
|
||||
No logro pegar desde la Row 1 de la grilla, siempre comienza de la Row 0, me puedes ayudar, gracias
|
#6
|
||||
|
||||
Cristhor1982,
El código que te indique anteriormente define de forma dinámica las filas y columnas del control TStringGrid y permite copiar desde y hacia el control por medio del Clipboard, quizás esta solución se pueda adaptar a tu proyecto. Espero sea útil Nelson. |
#7
|
||||
|
||||
Cita:
De este modo pegará los valores en la columna y a partir de la fila que indique la celda seleccionada actualmente: Si deseas utilizar el edit para seleccionar la columna, reemplaza la línea (*) por:
Saludos.
__________________
Daniel Didriksen Guía de estilo - Uso de las etiquetas - La otra guía de estilo .... |
#8
|
||||
|
||||
Muchas gracias, me parece que voy a probar poniendole algun ciclo...
|
#9
|
||||
|
||||
Ecfisa
Muchas Gracias...Resulto a la perfeccion |
#10
|
||||
|
||||
Esto esta funcionando "Bien", pero necesito que los valores Vacios de lo que copio no los inserte, trate con un IF TS[i]='' then..etc pero no puedo, alguien que me de una pista |
#11
|
||||
|
||||
Cristhor1982,
Cita:
Luego, si hay texto en el Clipboard este es procesado: De esta forma solo se copia al TStringList los valores diferentes de blanco del Clipboard, usando el carácter blanco como separador de data. Adicionalmente: No verifica si el valor es blanco, solo verifica si el valor es empty, contrariamente: Si verifica si el valor es blanco. Te sugiero probar ambas opciones e implementes la que mejor se adapte a tu proyecto. Espero sea útil Nelson. Última edición por nlsgarcia fecha: 18-12-2012 a las 22:53:50. |
#12
|
||||
|
||||
Cita:
|
#13
|
||||
|
||||
Ayuda (2) - Clipboard hacia TStringGrid
Amigos, de nuevo con el problema para pegar desde clipboard a TStringGrid...
Ahora necesito pegar esto Equipo 12345 Fecha/Hora 23-may-2013 11:49:11 CLT Horometro 1111 Operador 12 Cancha 20 Insumo 6789 Cantidad 121 y quede de esta forma Equipo Fecha/Hora Horometro Operador Cancha Insumo Cantidad 15503 23-may-2013 11:49:11 CLT 1515 363 32 50085645 121 POR FAVOR AYUDA...Llevo unos dias tratando y me pega en cualquier lado.... SAludos |
#14
|
||||
|
||||
Hola Cristhor1982.
Recuerda que: preguntas diferentes = hilos diferentes (Punto 8 de la guía de estilo). Saludos y gracias por tu colaboración
__________________
Daniel Didriksen Guía de estilo - Uso de las etiquetas - La otra guía de estilo .... |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Copiar/pegar desde el Clipboard a otra Aplicación | broly7 | Varios | 4 | 07-03-2011 17:08:53 |
Pegar imagen desde el Portapapeles (Clipboard) | gluglu | Gráficos | 8 | 20-10-2010 15:09:55 |
tabla a clipboard | picap | Varios | 4 | 13-05-2010 08:23:07 |
Copiar Y Pegar texto en las celdas de un StringGrid | rgstuamigo | OOP | 2 | 01-12-2008 13:55:51 |
Una clase al ClipBoard | bustio | OOP | 2 | 07-07-2004 00:35:16 |
|