Topic: Fastreport - search and highlight

Hi Dmitry,
Could you help me please?
In Fastreport, I have a field (counties.description) that can hold a large amount of text.
In my example, I want to highlight wherever the word 'Coventry' occurs (in the attachment, it should find and highlight 'Coventry' two times).
Any ideas how I can do this?
Thanks,
Derek.

Post's attachments

Attachment icon texthighlighting.zip 338.42 kb, 516 downloads since 2018-09-18 

Re: Fastreport - search and highlight

Hello.


Right mouse click on Memo (Reportcountiesdescription) then enable option "Allow HTML Tags"


script for fastreport:

procedure ReportcountiesdescriptionOnAfterData(Sender: TfrxComponent);
begin
  Reportcountiesdescription.Text := ReplaceStr(Reportcountiesdescription.Text, 'Coventry', '<b>Coventry</b>');                                            
end;
Dmitry.

Re: Fastreport - search and highlight

Hello Dmitry,
Wow - it works great.  I didn't realise you needed to enable HTML tags as well.
Thanks for sorting it and for the quick reply.
Derek.

Re: Fastreport - search and highlight

Hello Dmitry, Derek

As Derek, I wanted to bring out in bold a term that often came up in a report without ever finding the solution.

I read FastReport's documentation without finding the answer.

I ended up thinking that it could not be.

In the past, I had already used HTML code in Delphi code, but I never thought of doing it directly in FastReport.

Your little procedure for doing this is just ideal. I think we can chain other properties: color, italic ...

Thanks again for this help.

Regards

JB

Re: Fastreport - search and highlight

Hi Jean,
Yes, it's possible to add other properties - <b><u><i> xxxxxxx </i></u></b> etc etc.
But I haven't found a way yet to get <color=?> xxxxx</color> or <size=nn> xxxxx </size> to work.
Perhaps you can find a way.
But to 'bold' was my main requirement so what Dmitry has explained is very useful.
Regards,
Derek.

Re: Fastreport - search and highlight

<font color=red>and this is a red one</font>


More info
https://www.fast-report.com/en/documentation/frx3user/Creating%20reports/HTML-tags%20in%20the%20'Text'%20object.htm

Dmitry.

Re: Fastreport - search and highlight

Hi Dmitry,
Thanks for information about <font color=?> - reports look much better now with combinations of color and highlighting.
Derek.