CrLf Line Feed in text variable in a report

andy76andy76 Member Posts: 616
Hello,

I want to concatenate two variable in the sourceExpression of a TextBox variable multiline in a report.

var1 + ' ' + var2 prints on the same line

but I want something like:

var1 + crlf + var2 where crlf means a line feed/return to print on two lines


without creating 2 different text variables.

Is that possible? How?

Thank you

Comments

  • andy76andy76 Member Posts: 616
    Is it enough something simple like this?

    var1 +'\' + var2

    It seems to work correctly...Do you agree?
  • XypherXypher Member Posts: 297
    Create a global Text variable (of 2 length if you want) and set it to the following at the init of the report:
    globalTextVar[1] := 13;
    globalTextVar[2] := 10;
    

    Then use globalTextVar wherever you want CrLf (of course you'd set the variable name to something a bit shorter though.)


    But with your example I believe the CrLf or '\' will show up with just blocks.

    So I would recommend doing something like...
    MagicNum  Integer
    padChar   Text
    
    //Depending on the size of the Textbox you will want to figure out how many 'padChar's you'll need to drop the 2nd portion of text
    
    padChar[1] := 255;  //Define this somewhere in report init or wherever
    
    CLEAR(globVarTextBox);
    
    IF STRLEN(Record.Field) < MagicNum THEN
      globVarTextBox := PADSTR(globVarTextBox,(MagicNum-STRLEN(Record.Field)),padChar);
    
    globVarTextBox += Record.Field1 + ' ' + Record.Field2;
    

    The idea is to increase the length of the first "Field1" value enough to force the second value to drop to the next line.
Sign In or Register to comment.