Ver Mensaje Individual
  #2  
Antiguo 23-07-2004
Avatar de delphi.com.ar
delphi.com.ar delphi.com.ar is offline
Federico Firenze
 
Registrado: may 2003
Ubicación: Buenos Aires, Argentina *
Posts: 5.932
Reputación: 27
delphi.com.ar Va por buen camino
Si puedes hacerlo, recuerda que cuando imprimes directamente en el puerto, es como sie estuvieras armando un archivo de texto, y puedes utilizar cualquier función de strings para hacerlo. Podrías armarte algunas funciones del tipo LPad o RPad y definirle un ancho estricto a cada columna.

Yo tengo armadas estas funciones sobrecargadas:
Código Delphi [-]
function LPad(Value: string; Key: Char = ' '; ALenght: Integer = 0): string;
var
  iLen: Integer;
begin
  iLen := Length(Value);

  if (iLen > ALenght) then
    Result := Copy(Value, 1, ALenght)
  else
    Result := StringOfChar(Key, ALenght-iLen) + Value;
end;

function LPad(Value: Integer; Key: Char = '0'; ALenght: Integer = 0): string;
begin
  Result := LPad(IntToStr(Value), Key, ALenght);
end;

function RPad(Value: string; Key: Char = ' '; ALenght: Integer = 0): string;
var
  iLen: integer;
begin
  iLen  := Length(Value);

  if (iLen > ALenght) then
    Result := Copy(Value, 1, ALenght)
  else
     Result := Value + StringOfChar(Key, ALenght-iLen);
end;

function RPad(Value: integer; Key: Char = '0'; ALenght: Integer = 0): string;
begin
  Result := RPad(IntToStr(Value), Key, ALenght);
end;

Saludos!
__________________
delphi.com.ar

Dedique el tiempo suficiente para formular su pregunta si pretende que alguien dedique su tiempo en contestarla.
Responder Con Cita