GetHighlight
Parser.GetHighlight method
Extracts a highlight from the document.
public HighlightItem GetHighlight(int position, bool isDirect, HighlightOptions options)
Parameter | Type | Description |
---|---|---|
position | Int32 | The start position of the highlight. |
isDirect | Boolean | The value that indicates whether highlight extraction is direct. true if the higlight is extracted by the right of position; otherwise, false . |
options | HighlightOptions | The highlight extraction options. |
Return Value
An instance of HighlightItem
class that represents the extracted highlight; null
if highlight extraction isn’t supported.
Remarks
Learn more:
Examples
The following example shows how to extract a highlight that contains 3 words:
// 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
- class HighlightItem
- class HighlightOptions
- class Parser
- namespace GroupDocs.Parser
- assembly GroupDocs.Parser