Using RTF (RichText) inside Variables?

edited 2:40AM in FastReport 4.0
Hi...

I've a report with a richtext control placed on it. I've placed a TfrxUserDataSet component on that form to return the master data. Inside the richtext control, I've placed the folloging snippet:
Hello xyz,

[TEXT]

Regards,
...

Inside the method "...GetValue(const VarName: string; var Value: Variant);", I've tryed the following:
  ReportEngine.Variables['TEXT'] := QuotedStr(MyRichText);

...but instead of rendering the richtext, FastReport outputs the richtext-description such as {rtf/ansi/....}.

What should I do to be able to render the real richtext?

Regards,
Marc

Comments

  • Anu de DeusAnu de Deus Hampshire, UK
    edited 2:40AM
    Have you tried <!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->frxRichView1.AllowExpressions := false;<!--fontc--></span><!--/fontc--> ?
  • edited 2:40AM
    Hi...

    If I disallow expression, the variable [TEXT] won't be replaced...

    Regards,
    Marc
  • Anu de DeusAnu de Deus Hampshire, UK
    edited 2:40AM
    Of course, I should have noticed that.
    Anyway, I think the moment you use QuoteStr or GetValue your richtext no longer is 'rich', as you are type casting it as a plain string.
    I don't know how to convert it back to RichText format.
    Anyone?

    However, is it possible that you split your RichView object in 3 objects?
    You have this
    Band
    RichView object

    why don't you try putting the text before and after [TEXT] in separate objects, like this:
    Band
    RichView1.text = 'Hello XYX'
    RichView2.text = [TEXT]
    RichView3.text = 'Regards...'

    I'm suggesting that because I wonder if it's displaying the plain string because you are mixing its value with the text before and after it, but maybe if you try it separately it may work.

    The only way I had success to load the value of a TrfxRichView from a separate source was by code, and like this:
    rfxRichView1.RichEdit.Lines.LoadFromStream(MydataStream);

    I hope I could give you some ideas.
  • edited 2:40AM
    Hi..

    Thank you...splitting the richtext into three parts isn't a solution, cause the enduser can place the placeholder at any position...but I'll try to communicate with the real object and loading the richtext using a stream..

    Best regards,
    Marc
  • gordkgordk St.Catherines On. Canada.
    edited 2:40AM
    you cannot pass richtext in a variable. variables were not designed for that.
    you can assign the lines of a delphi richtext component to fr's richtext object.
  • edited 2:40AM
    Hi..

    I've used direct control access and now it works very well for me.

    Thank you very much for all responses 8-)

    Regards,
    Marc

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.