Help - Search - Members - Calendar
Full Version: How to add breakline (#13#10) via code?
Fast Reports forum > Fast Reports Products > FastReport 3.0
kaju74
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:

CODE

repEngine.Variables['HEADER'] := QuotedStr('Line1' + #13 + 'Line2');


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

Regards,
Marc
MrSpock
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:

CODE
frxRepRechnung.Variables['RepName'] := QuotedStr('Hello1$Hello2$Hello3');


And in your report you use a memo with the following code:
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. huh.gif
kaju74
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 wink.gif
creator
Try this:

CODE
repEngine.Variables['HEADER'] := 'Line1'#13#10'Line2';

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.