Adding string to Memo.Lines.text in script breaks the line

edited 10:50AM in FastReport 4.0
Hello,

My problem is this:
I have a memo with text let's say 'Joe'.

In the Onbefore print I check if the family name is Smith so I need to concatenate so as to be Joe Smith.

However the following in the script breaks the line:


Memo.Lines.Text := Memo.Lines.Text+' Smith ';

this too: Memo.Text := Memo.Text+' Smith ';

So instead of 'Joe Smith' the result is:

'Joe
Smith'

>

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 10:50AM
    again do your concatenating in the obp of the band and assign to memoviews memo.

    lines property is a zero based array
    memo text property is all the text of the memo.
  • Anu de DeusAnu de Deus Hampshire, UK
    edited June 2011
    Any memo text value will have a CRLF in the end.
    You could do this:

    lTxt := memo1.text; // Internally, it will have 'Joe'#13#10
    delete(lTxt,length(ltxt)-1,2);
    Memo1.text := lTxt +' Smith';
  • edited 10:50AM
    Any memo text value will have a CRLF in the end.
    You could do this:

    lTxt := memo1.text; // Internally, it will have 'Joe'#13#10
    delete(lTxt,length(ltxt)-1,2);
    Memo1.text := lTxt +' Smith';

    Thank you very much I will try it!
  • edited 10:50AM
    Any memo text value will have a CRLF in the end.
    You could do this:

    lTxt := memo1.text; // Internally, it will have 'Joe'#13#10
    delete(lTxt,length(ltxt)-1,2);
    Memo1.text := lTxt +' Smith';
    Trim() should do the same work.

    lTxt := Trim( memo1.text ); // Internally, it will have 'Joe'#13#10
    Memo1.text := lTxt +' Smith';
  • Anu de DeusAnu de Deus Hampshire, UK
    edited 10:50AM
    Doesn't Trim only remove blank spaces, leaving the CRLF there?
  • edited June 2011
    Doesn't Trim only remove blank spaces, leaving the CRLF there?
    Trim should remove all white space characters (codes below ASCII #32) from the begin and end of a string, leaving embedded white space in place. I think.

Leave a Comment