ParserGetHighlight Method
Extracts a highlight from the document.

Namespace: GroupDocs.Parser
Assembly: GroupDocs.Parser (in GroupDocs.Parser.dll) Version: 20.8.0
Syntax
public HighlightItem GetHighlight(
	int position,
	bool isDirect,
	HighlightOptions options
)

Parameters

position
Type: SystemInt32
The start position of the highlight.
isDirect
Type: SystemBoolean
The value that indicates whether highlight extraction is direct. true if the higlight is extracted by the right of position; otherwise, false.
options
Type: GroupDocs.Parser.OptionsHighlightOptions
The highlight extraction options.

Return Value

Type: HighlightItem
An instance of HighlightItem class that represents the extracted highlight; null if highlight extraction isn't supported.
Remarks
Examples

The following example shows how to extract a highlight that contains 3 words:

C#
// Create an instance of Parser class
using (Parser parser = new Parser(filePath))
{
    // Extract a highlight:
    HighlightItem hl = parser.GetHighlight(2, true, new HighlightOptions(3));

    // Check if highlight extraction is supported
    if (hl == null)
    {
        Console.WriteLine("Highlight extraction isn't supported");
        return;
    }

    // Print an extracted highlight
    Console.WriteLine(string.Format("At {0}: {1}", hl.Position, hl.Text));
}
See Also