Focal Point
[CLOSED] Highlight Keywords

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/642108202

August 07, 2009, 12:34 PM
gkata
[CLOSED] Highlight Keywords
I have to search comments and look for a keyword (i.e. broke). The user wants to create an excel report with the keyword highlighted. I can do this when the report is created in html, but not excel. Any ideas on how to only highlight a keyword within comments varchar(2000)?

This message has been edited. Last edited by: Kerry,
August 07, 2009, 01:29 PM
Darin Lee
You're not going to be able to do it with any stylesheets, but you could "fool" it into displaying a string as bold, colored, etc. using HTML tags. Excel knows what to do with them.

Try doing a string replace of the keyword, replacing it with <b>keyword</b>. Like

COMPUTE H_COMMENT/A2200=STRREP(200,COMMENT,7,'keyword',14,'<b>keyword</b>',2200,H_COMMENT);


And then include

ON TABLE SET HTMLCSS ON
ON TABLE SET ONLINE-FMT EXL2K


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
August 07, 2009, 02:43 PM
gkata
Last time -

it displays starting 'bold' html tag, then the keyword, then the ending html bold tag.

It doesn't actually bold the keyword. If I paste the contents of the cell here, it will display as bold, because it's resolving the html tags.
August 08, 2009, 03:52 AM
<JG>
use a very simple template /macro

Write your keyword into a cell in your output in your HEADING (for example cell A1)

Create an Auto_Open or Workbook_Open macro in your template

xlEqual means it must be an exact match for content but not case.

Cells.Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=$A$1"
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.ColorIndex = 4
End With
Range("A1").Select
Selection.ClearContents