Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guνa de estilo Temas de Hoy

Coloboraciσn Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 06-06-2008
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicaciσn: Ciudad de Mιxico
Posts: 20.269
Poder: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
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
Responder Con Cita
 



Normas de Publicaciσn
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El cσdigo vB estα habilitado
Las caritas estαn habilitado
Cσdigo [IMG] estα habilitado
Cσdigo HTML estα deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Ϊltimo mensaje
Buscar archivo text, sin ruta. Caral Varios 18 26-02-2008 18:25:06
Aρadir archivo .text a combobox (Nombre) Caral Varios 11 30-07-2007 22:25:28
ftFmtMemo to text johurgi Varios 1 20-10-2006 17:45:01
Text File...Aplicaciones Caral Varios 4 03-10-2006 18:01:52
Guardar lo que tengo en un Edit1.text y edit2.text en una base de datos firebird jorgeluisc Conexiσn con bases de datos 1 23-04-2006 18:29:28


La franja horaria es GMT +2. Ahora son las 08:17:07.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducciσn al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi