Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • Last Modified:

Field Alignment in text file

I'm writing a text file with different field of datas, the worst thing that I couldn't make it align at the same column for each field.  Would there be any solution to this problem?


Thank you
0
PratS
Asked:
PratS
1 Solution
 
kretzschmarCommented:
>Would there be any solution to this problem?

do yourself your textout

in which control do you display your data?
0
 
PratSAuthor Commented:
well, the text out is there! it depends on the result format and it is not list down in column as it should be.  I used spaces in between to separate them into each field.
0
 
kretzschmarCommented:
maybe you should explain a bit more
or show a bit code where you have the problem

if it is for a fixed textfile
i used a function like this

function filler(AString : String; ALen, ADirection : Integer) : String;
var i : integer;
begin
  result := AString;
  if AString < ALen then
  begin
    case ADirection of
      0 : begin  //left
            while result < ALen do result := result+' ';
          end;
      1 : begin  //center
            while result < ALen do
            begin
              result := result+' ';
              if result < ALen then
                result := ' ' + result;
            end;
          end;
      2 : begin  //right
            while result < ALen do result := ' '+result;
          end;
    end;
  end;
end;

you can now call this like

s := filler('ABC',10,0);

well, just from head
-> not tested

meikl ;-)
 
0
 
CleanupPingCommented:
PratS:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
kacorretiredCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
       to accept kretzschmar's answer
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones

kacor
EE Cleanup Volunteer
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now