Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

problem with Memo field

edited February 2003 in General
I have this procedure which scrolls through my database and I am trying to
line up all the fields so it is easy to read. However it is always coming
out all messed up?

the bottom procedure is taking a field and finding out how many spaces i
have to add to the string, however it seems that a space is not the same
width as a character.

Any suggestions?

thanks,
Mike


procedure TForm1.ppDBMemo1GetMemo(Sender: TObject; aLines: TStrings);
var i,j, tempLength : integer;
OrdNum,Description,DateMRD,Cost : string;
begin
tblCust_RO.First;
for i := 0 to tblCust_ro.RecordCount - 1 do begin
templength := Length(tblCust_ro.FieldByName('OrderNo').AsString);
OrdNum := tblCust_ro.FieldByName('OrderNo').AsString;
for j := TempLength to tblCust_ro.FieldByName('OrderNo').DisplayWidth do
OrdNum := OrdNum + ' ';
templength := Length(tblCust_ro.FieldByName('Description').AsString);
Description := tblCust_ro.FieldByName('Description').AsString;
for j := TempLength to
tblCust_ro.FieldByName('Description').DisplayWidth do
Description := Description + ' ';
templength := Length(tblCust_ro.FieldByName('Date').AsString);
DateMrd := tblCust_ro.FieldByName('Date').AsString;
for j := TempLength to tblCust_ro.FieldByName('Date').DisplayWidth do
Datemrd := DateMRD + ' ';
templength := Length(tblCust_ro.FieldByName('Cost').AsString);
Cost := tblCust_ro.FieldByName('Cost').AsString;
for j := TempLength to tblCust_ro.FieldByName('Cost').DisplayWidth do
Cost := Cost + ' ';
Alines.Add(OrdNum + ' ' + DateMRD + ' ' + Description + ' ' + Cost);
tblCust_ro.Next;
end;
end;

Comments

  • edited February 2003
    Mike

    I had a similar problem and was appending tabs chr(9) instead of space and
    the memo was readible.
    However, I have not been able to setup the tabs positions.

    Max

  • edited February 2003

  • edited February 2003
    Bruce, thank you.

    Have downloaded the demo. Will play with it.
    Seems to be great and inexpensive.

This discussion has been closed.