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

edited 5:44AM 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 5:44AM
    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 5:44AM
    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 5:44AM
    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 5:44AM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.