0

We can press Ctrl + F in browser to find a text on the page as it gets highlighted if found a match. Even we can use good browser extensions to define our keywrords and then use the extension interface to highlight all occurrences etc.

Note: We must use Internet Explorer

Problem: For some particular application, the data is received as rich text box/rich text format. So we cannot use browser Ctrl + F or any extension to highlight the text. The simple reason is the text is inside the value attribute and not as typical HTML element text.

What I have tried or can do: I have tried browser extensions, Ctrl + F but it wont highlight the words. I can develop a winform application, embedding an IE control in it but still I am not sure how the highlight feature can be achieved, or even if its possible in this scenario or not.

Please also note that I don't have any control to change the HTML code, otherwise I would already have done it)

So is there a way the highlight effect can be achieved? please help (for instance I want to highlight the words 'converted' and 'value' from the following sample code)

<object name="TextData" classid="clsid:4cbabd-ff93-431-a92f-2fa664f970" codebase="ppp13.cab" id="TextData" style="border-width:0px;border-style:None;height:186px;width:98%;">
        <param name="WordWrap" value="True">
        <param name="PrintViewMode" value="True">
        <param name="FittedView" value="False">
        <param name="ShowStatusBar" value="False">
        <param name="ShowRuler" value="False">
        <param name="ShowToolBar" value="False">
        <param name="BorderMargin" value="True">
        <param name="RTFOutput" value="True">
        <param name="ReadOnlyMode" value="True">
        <param name="VertScrollBar" value="True">
        <param name="HorzScrollBar" value="True">
        <param name="TerKey" value="8YP41-NM5Q2-34BL3">
        <param name="Data" value="{\rtf1\ansi\deflang1033\ftnbj\uc1\deff1
{\fonttbl{\f0 \froman \fcharset0 Times New Roman;}{\f1 \fswiss Arial;}}
{\colortbl ;\red255\green255\blue255 ;\red0\green0\blue0 ;}
{\stylesheet{\f1\fs24\cf2\cb1\ulc2 Normal;}{\cs1\cf2\cb1\ulc2 Default Paragraph Font;}}
{\*\revtbl{Unknown;}}
\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\headery720\footery720\deftab720\formshade\aendnotes\aftnnrlc\pgbrdrhead\pgbrdrfoot
\sectd\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\headery720\footery720\sbkpage\pgncont\pgndec
\plain\plain\f1\fs24\qc\lang1033\hich\f1\loch\f1\b 1cm \b0 = to \b 10mm \b0 Thus value of 10 cm is converted into 100mm.\plain\f1\fs24\par}
">
        <param name="InWebTer" value="True">

    </object>
Usman Waheed
  • 86
  • 1
  • 8
  • Are you using a RichTextBox control in winforms, or something else? If it is the former, you can try to refer to [this article](https://www.c-sharpcorner.com/article/search-and-highlight-text-in-rich-textbox/). If not, I think this requirement might be more difficult, as described in [this answer](https://stackoverflow.com/questions/67119347/highlighting-text-within-an-input-field#answer-67119476) . – Xudong Peng Feb 04 '22 at 07:42
  • Its a website (I copy pasted the HTML source of the page in my question), I know its a rich text box they (developers) have used as I can see the rich text markup e.g. `\colortbl`. I understand that it would be tuff, but is there a way to highlight text in same code / text box? – Usman Waheed Feb 04 '22 at 11:28
  • Yes, I know it's html code, so I want to know what plugin it is using to render these html elements. And you mentioned that you can't modify the relevant code of the front end, so I think you need to look for possible solutions in other directions(such as server side code), otherwise this requirement is unrealizable in my opinion. – Xudong Peng Feb 08 '22 at 07:44
  • Sorry, I have no idea about it, all I can see is a rich text box in which picture and other rich text data is displayed. I just tried to figure out what it could be, but the page source code doesn't help. What ever is the plugin/control, its data can only be viewed in IE, if I open in chrome, it just shows an empty text box. – Usman Waheed Feb 09 '22 at 08:45

0 Answers0