FlexReport value field printing with different colors

Posted by: saidnai on 24 November 2021, 5:50 am EST

  • Posted 24 November 2021, 5:50 am EST

    Hi all,

    Another challenge is to print a value of the field with different color, like follow :

    Field.value = “My name is : XXXXXX”

    Part one : ‘My name is:’ in Black color

    Part one : ‘XXXXXX’ in Red color

    is there a simple way to do it?

    Thank for your support

    Said

  • Posted 24 November 2021, 7:40 am EST

    Hi Said,

    The best way to achieve this will be to use two different text fields. One with “My name is” in black color and other with the name “XXXX” in red color. Please refer to the sample attached.

    Regards

    Avnish

    temp.zip

  • Posted 24 November 2021, 8:03 am EST

    Dear Avnish,

    I know your meaning mabye i gave a worse sample. The value of the field is comming from the database. I need to look for a special part in the value of the field that contained “(Block no. 999)” and this i have to print it in red color.

    Best regards

    Said

  • Posted 24 November 2021, 8:09 am EST

    Dear Avnish,

    I have attached a sample.

    Best regards

    Said

  • Posted 24 November 2021, 8:10 am EST

    Dear Avnish,

    sorry now with.

    Best regards

    Said

    Sub Report.zip

  • Posted 29 November 2021, 3:06 am EST

    Hi Said,

    This is not directly possible in FlexReport.

    As a workaround, you can use the SuperLabel field and the GetScriptObject event to provide formatted HTML values for that field of each record.

    You can assign an unknown variable as the Text of the SuperLabel field using the Details.OnPrint script and when the Report will encounter these unknown variables, it will fire the GetScriptObject event if the ExposeScriptObjects property of the Report is true. You can then provide custom values and show data as you want.

    Please refer to the sample attached.

    Regards

    Avnish

    FR_FormatText.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels