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 8:40AM
    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

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.