How to add breakline (#13#10) via code?

Hi...

I like to pass a variable value from my delphi app to the report which should contains multiple lines. If I write something like this:
repEngine.Variables['HEADER'] := QuotedStr('Line1' + #13 + 'Line2');

...this didn't work. How do I seperate multiple lines using code...?

Regards,
Marc

Comments

  • edited October 2006
    Hello kaju74,

    the report variable expects an expression as value. #10 or #13 are not part of a valid expression as you can test by using the edit function of the variable in FR3.

    What you could do, is to define a symbol which is not part of your string, but should represent the linebreak. Let's use a $ as example.

    In Delphi you write then:
    frxRepRechnung.Variables['RepName'] := QuotedStr('Hello1$Hello2$Hello3');
    

    And in your report you use a memo with the following code:
    procedure Memo11OnBeforePrint(Sender: TfrxComponent);
    var
       posi   : Integer;
       output : String;
    begin
       output := <RepName>;
       posi := Pos('$',output);
       while posi > 0 do
       begin
           Memo11.Text := Memo11.Text +Copy(output,1,posi-1)+#10#13;
           Delete(output,1,posi);
           posi := Pos('$',output);
       end;
       Memo11.Text := Memo11.Text +output;
    end;
    

    That should work for you. ;)
  • edited 4:04AM
    Hi...

    Thank you for answering. Well, this is a liltte bit circuitous but should work 8-)) Are there NO special characters (like \N) to solve this while writting...? If not, maybe that's a little improvement for FR4 ;)
  • edited 4:04AM
    Try this:
    repEngine.Variables['HEADER'] := 'Line1'#13#10'Line2';
    

Leave a Comment