Ver Mensaje Individual
  #7  
Antiguo 10-06-2008
Paulao Paulao is offline
Miembro
 
Registrado: sep 2003
Ubicación: Rua D 31 Casa 1 - Inhoaíba - Rio de Janeiro - RJ - Brasil
Posts: 637
Reputación: 21
Paulao Va por buen camino
Hola, caro, hizo este codigo y me lo da el resultado que yo quiero, con una excepcion. Necesito crear una forma de buscar los itenes tambiem y yo puedo tener un solo iten o mas, y ahora estoy viendo como hacer un for o while para llenar mi stringlist con los itenes. Esta ahora es mi duda.
Cita:
procedure TForm1.BitBtn4Click(Sender: TObject);
var
Arq: TextFile;
s,Path:String;
ccf,coo,cpf,nome:String;
Linha: TStringList;
PosIni,j: Integer;
begin
Linha := TStringList.Create;
Path := 'C:\Sweda\Destino\Teste.TXT';
AssignFile(Arq,Path);
Reset(Arq);
while not Eof(arq) do
begin
Readln(Arq,s);
j := AnsiPos('CCF:',s);
PosIni := Pos('CCF:',s);
if j <> 0 then
ccf := Copy(s, PosIni+5, 6);

j := AnsiPos('COO:',s);
PosIni := Pos('COO:',s);
if j <> 0 then
coo := Copy(s, PosIni+5,6);

j := AnsiPos('CNPJ/CPF CONSUMIDOR:',s);
PosIni := Pos('CNPJ/CPF CONSUMIDOR:',s);
if j <> 0 then
cpf := Copy(s, PosIni+21,14);

j := AnsiPos('NOME',s);
PosIni := Pos('NOME:',s);
if j <> 0 then
nome := Copy(s, PosIni+6, 35);

j := AnsiPos('CUPOM FISCAL',S);
if j <> 0 then
Linha.Add(ccf+coo+cpf+nome);
end;

Memo1.Lines.Add(Linha.Text);

CloseFile(Arq);
end;
Responder Con Cita