Ver Mensaje Individual
  #2  
Antiguo 24-06-2007
Robert01 Robert01 is offline
Miembro
 
Registrado: feb 2006
Ubicación: Córdoba, Argentina
Posts: 895
Reputación: 19
Robert01 Va por buen camino
Seleccionas los datos y usas esta función que tiene el ejemplo de neftali en su página:

Código Delphi [-]
procedure TFormStringGrid.sbCopiarClick(Sender: TObject);
var
  i, j:Integer;
  Str:String;
begin

  // Inicializamos
  Str := '';
  // Para cada línea de las selecciondas
  for i := (StringGrid1.Selection.Top) to (StringGrid1.Selection.Bottom) do begin
    // Si no es la 1ª linea, añadimos un salto de línea
    if (i <> StringGrid1.Selection.Top) then begin
      Str := Str + #13#10;
    end;
    // Para cada elemento dentro de la línea (celdas)
    for j := 0 to (StringGrid1.Rows[i].Count - 1) do begin
      // Si no es la primera celda, añadimos un separados
      if (j <> 0) then begin
        Str := Str + ';';
      end;
      // Construimos la cadena
      Str := Str + StringGrid1.Rows[i].Strings[j];
    end;
    // La guardamos en el clipboard (como texto)
    Clipboard.AsText := Str
  end;

  MessageDlg('El contenido de la/s celda/s se ha copiado al portapapeles de windows', mtInformation, [mbOK], 0);

end;

Saludos
Responder Con Cita