Separate text in list format into text file! lazarus / 21-General ---------------------------------------------------------------------- Robert W.B. · 2022-01-21 19:00 I'm trying to separate text in line format in text file, but it does not work!  This is what I'm trying to accomplish. Date:                Food:            Price: 01-03, 2022    Tomatoes     $1.05 10-03, 2022     Fries             $4.99 15-03, 2022     Bag               $0.50 This is what i looks now! Date:                Food:            Price: 01-03, 2022    Tomatoes     $1.05 10-03, 2022     Fries         $4.99 15-03, 2022     Bag         $0.50 Is there commands in Pascal that correct this issue? Thanks in advance. Bob ---------------------------------------------------------------------- paweld · 2022-01-21 19:23 Format function: https://wiki.freepascal.org/Format_function Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   memo1.Lines.Add(Format('%-12s   %-10s   %-8s', ['Date:', 'Food:', 'Price:']));  memo1.Lines.Add(Format('%-12s   %-10s   %8s', ['01-03, 2022', 'Tomatoes', '$1.05']));  memo1.Lines.Add(Format('%-12s   %-10s %8s', ['10-03, 2022', 'Fries', '$4.99']));  memo1.Lines.Add(Format('%-12s   %-10s   %8s', ['15-03, 2022', 'Bag', '$0.50'])); ---------------------------------------------------------------------- Robert W.B. · 2022-01-21 21:07 Thanks paweld for the help. I try to se how i can create a textfile with. for a:=1 to 10 do begin filewrite(myFile, format('%-12s', intToStr(myVar1[a])+ intToStr(myVar2[a])+intToStr(myVar3[a])  )  ); end; But it not working! Suggestions paweld? ---------------------------------------------------------------------- paweld · 2022-01-21 22:02 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var  tf: TextFile;  i: Integer;begin  AssignFile(tf, 'test_file.txt');  if FileExists('test_file.txt') then    append(tf)  else    rewrite(tf);  for i := 1 to 100 do    writeln(tf, Format('%-13s %-5d   %5d', ['Interation no', i, Random(9999)]));  CloseFile(tf);end;