Delphi value to FastReport

I'm trying to pass a richedit delphi value for FastReport but it passes the value he is entering ' before and after the value.

Example:

Richedit.text = 'Example Text';

when I move to the FastReport looks like this:

'Example Text'


I want to take '


I want the value to be passed this way:

Example Text


CODE:
frxReport1.Variables['var1'] := QuotedStr(richedit.text);

Comments

  • LurkingKiwiLurkingKiwi Wellington, New Zealand
    edited 6:47PM
    chorao157 wrote: »
    I'm trying to pass a richedit delphi value for FastReport but it passes the value he is entering ' before and after the value.

    CODE:
    frxReport1.Variables['var1'] := QuotedStr(richedit.text);
    

    I have found that if a FastReport variable's new value has a CRLF in it, then the outer quotes get printed, otherwise they are required to stop FR doing a recursive variable lookup.
    I have a function like this:
    procedure SetReportVar(Report : TfrxReport; TheVar, TheValue : string);
    begin
    if pos(#13, TheValue) > 0 then {Assume correct CRLF pairs used in string so use directly}
      Report.Variables[TheVar] := TheValue
    else {Need to surround with extra quotes to prevent recursive lookup}
      Report.Variables[TheVar] := '''' + TheValue + '''';
    end;
    

    None of my variables have internal quotes, so I've never tried to use QuotedStr.
    You may have to do something like copy(tempstr, 2, length(tempstr) - 2) to strip the quotes if there's a CR in there, or cut the length by one and delete the first char


Leave a Comment