We need to highlight the search term in Aspose Excel Viewer. Kindly guide me how to add that feature
@Prinston
We will be referring to the search highlighting effect in Excel to design and implement highlighting search terms in Aspose Cells Viewer.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSAPP-4174
@Prinston
we have added new setting parameter in loadoptions :searchHighlightColor
for example:
in the below code ,we set the color to “#ea6f6f1f”,
the color must include an alpha channel for transparency
const option = {
updateMode: 'server',
updateUrl: '/GridJs2/UpdateCell',
showToolbar: true,
//showFileName:false,
//showGrid: true,
mode: 'read',
//support multiple language ,the locale is: en zh es pt de ru nl
local: 'en',
//the highlight background color for the search term,it is optional,the default color is:#dbe71338
//the color must include an alpha channel for transparency
searchHighlightColor: '#ea6f6f1f',
};
xs = x_spreadsheet('#gridjs-demo-uid', option)
below is the snapshot for the search highlight effect,you can set any color per your request.
We will update it in our online Aspose Cells Viewer/Editor app next week.
It will be ready in the next v25.2 release of GridJs.
Thank you for the reply, appreciate it.
We want to highlight multiple sets of words, with each set of words highlighted in a color. For example, there will be 5 words which should be highlighted in green, 3 other words highlighted in red, 2 other words highlighted in pink. Is this possible ?
@Prinston
you want to do it inside one cell?
in order to show the highlight effect. the searched result cell text shall be updated to rich html.
and then reRender(). and after close search box. it shall be restored.
may be we can provide an api interface like
xs.customSearchHighlight(resultCellText,searchKey)
then you need to implement the highlight effect youself.
for example: (here I just define a simple text way to represent such requirement ,you can provide your suggestion)
xs.customSearchHighlight("hello nice to meet you,is there any question,nice day ","nice")
it will return :
"hello [style='color:#FF0000']nice[/style] to meet you,is there any question,[style='color:pink']nice[/style] day"
or
"hello [#FF0000]nice[/#FF0000] to meet you,is there any question,[pink]nice[/pink] day"
then based on the result text we can do the render work.