Hay algo que no entiendo. El texto que pones de ejemplo, ¿es de un sólo archivo o son tres? En el ejemplo que te pongo, presupongo que cada archivo tiene una sola factura:
Cσdigo Delphi
[-]
procedure TForm1.LeerArchivo(Archivo: String);
var
Lineas: TStringList;
Linea: String;
Token: String;
I, N: Integer;
begin
Lineas := TStringList.Create;
try
Lineas.LoadFromFile(Archivo);
for I := 0 to Pred(Lineas.Count) do
begin
Linea := Lineas[i];
N := Pos('CCF:', Linea);
if N > 0 then
begin
Token := '';
Inc(N, 4);
while (N <= Length(Linea)) and (Linea[N] <> ' ') do
begin
Token := Token + Linea[N];
Inc(N);
end;
txtCCF.Text := Token;
end;
N := Pos('COO:', Linea);
if N > 0 then
begin
Token := '';
Inc(N, 4);
while (N <= Length(Linea)) and (Linea[N] <> ' ') do
begin
Token := Token + Linea[N];
Inc(N);
end;
txtCOO.Text := Token;
end;
N := Pos('CONSUMIDOR: ', Linea);
if N > 0 then
begin
Token := '';
Inc(N, 12);
while (N <= Length(Linea)) and (Linea[N] <> ' ') do
begin
Token := Token + Linea[N];
Inc(N);
end;
txtConsumidor.Text := Token;
end;
end;
finally
Lineas.Free;
end;
end;
Aquí, txtCCF, txtCOO y txtConsumidor son tres componentes TEdit.
Si un sólo archivo contiene varias facturas, habrá que hacer algunas modificaciones.
// Saludos