We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Highlight multiple words in single document

My concern is when groupdocs highlight search result it creates a separate .html file, which highlight only that one particular query/word all over the document.

Is there any way groupdocs can highlight multiple query/word with different colors in a single .html file.


We are investigating this scenario. Your investigation ticket Id is SEARCHNET-2757.


An HTML file with highlighted search results can be further processed after generation by the GroupDocs.Search library, for example, using the Aspose.HTML library. You will need to find a tags named hitN (where N is an integer number) and subsequent span tags with the highlighted-term class. Then you need to replace groups of such consecutive tags with single span tags that include the found phrases in their entirety. To highlight with different colors, you need to replace the highlighted-term class with others that correspond to the required colors.

<a title="alice had" name="hit0"><span class="highlighted-term">Alice</span></a> <span class="highlighted-term">had</span>
<span class="highlighted-term-pink">Alice had</span>

Each found word can be marked with its own CSS class so that it is highlighted with its own color.