Ver Mensaje Individual
  #10  
Antiguo 18-12-2012
Avatar de Cristhor1982
Cristhor1982 Cristhor1982 is offline
Miembro
NULL
 
Registrado: dic 2012
Posts: 60
Reputación: 12
Cristhor1982 Va por buen camino
Código Delphi [-]
procedure TFR_EliminacionFolioMasivo.SG1KeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
var
  TS: TStrings;
  j,i : Integer;
begin
if ((ssCtrl in Shift) and (Key = 86)) or ((ssShift in Shift) and (Key = 45)) then
  if Clipboard.HasFormat(CF_TEXT) then
    with SG1 do
    begin
      TS := TStringList.Create;
      try
        TS.Text := clipboard.AsText;
        RowCount := TS.Count+1;
        for i:= 0 to TS.Count-1 do
        begin


          Cells[SG1.Col,SG1.Row+i]:= TS[i];   //desde row 1

          screen.Cursor := crsqlwait;
          fr_clave.SQL.Close;
              fr_clave.SQL.SQL.Clear;
              fr_clave.SQL.SQL.Add('EXEC_aCTeLIMINACIONfOLIOv2 1,0,');
              if ((Cells[1,1+i]<>'')AND ((Cells[2,1+i])<>'')) then
                begin
                 fr_clave.SQL.SQL.Add(''''+ Cells[1,1+i] +''',''' + Cells[2,1+i] +''',0,0,0,');
                 end
                 else
                 if ((Cells[1,1+i]<>'') AND (Cells[2,1+i]='')) then
                 begin
                 fr_clave.SQL.SQL.Add(''''+ Cells[1,1+i] +''',-1,0,0,0,')
                 end
                else
                fr_clave.SQL.SQL.Add('-1,''' + Cells[2,1+i] +''',0,0,0,');
                fr_clave.SQL.SQL.Add(''''+ fr_clave.TX_Rut.Text +''',0,0,0');
                fr_clave.SQL.Open;
                  if fr_clave.SQL.RecordCount <> 0 then
                  BEGIN

                 // SG1.RowCount :=SG1.RowCount+1;
                  SG1.Cells[1,i+1 ] := fr_clave.SQL['Folio'];
                  SG1.Cells[2,i+1 ] := fr_clave.SQL['Vale'];
                  SG1.Cells[3,i+1 ] := fr_clave.SQL['Periodo'];
                  SG1.Cells[4,i+1] := fr_clave.SQL['RutVisador'];
                  SG1.Cells[6,i+1 ] := fr_clave.SQL['RutVisado'];
                  SG1.Cells[8,i+1 ] := fr_clave.SQL['Motivo'];
                  SG1.Cells [5,i+1 ] := NombreTrabajador(SG1.Cells[4,i+1]);
                  SG1.Cells [7,i+1 ] := NombreTrabajador(SG1.Cells[6,i+1]);

          end;
          for j := 0 to 8 do
          begin
          SG1.Cells[j, SG1.RowCount] := '';
          end;
          end;
      finally
        screen.Cursor := crdefault;
        TS.Free;
        //clipboard.Clear;

    end;
end
  else
    ShowMessage('No hay texto en el PortaPapeles');
end;



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
Responder Con Cita