HighlightText

HighlightText(string, Color)

Highlights all matches of the sample text with the specified color.

public void HighlightText(string text, Color highlightColor)
ParameterTypeDescription
textStringThe text to highlight.
highlightColorColorThe color to highlight the text.

Examples

The following code sample shows how to highlight text in a PowerPoint presentation.

[C#]
using (Presentation presentation = new Presentation("SomePresentation.pptx"))
{
	// highlighting all separate 'the' occurrences
	presentation.HighlightText("the", Color.Violet);
	presentation.Save("SomePresentation-out2.pptx", SaveFormat.Pptx);
}

See Also


HighlightText(string, Color, ITextSearchOptions, IFindResultCallback)

Highlights all matches of the sample text with the specified color.

public void HighlightText(string text, Color highlightColor, ITextSearchOptions options, 
    IFindResultCallback callback)
ParameterTypeDescription
textStringThe text to highlight.
highlightColorColorThe color to highlight the text.
optionsITextSearchOptionsText search options ITextSearchOptions.
callbackIFindResultCallbackThe callback object for receiving search results IFindResultCallback.

Examples

The following code sample shows how to highlight text in a PowerPoint presentation.

[C#]
using (Presentation presentation = new Presentation("SomePresentation.pptx"))
{
	// highlighting all separate 'the' occurrences
	presentation.HighlightText("the", Color.Violet, new TextSearchOptions() {WholeWordsOnly = true}, null);
	presentation.Save("SomePresentation-out2.pptx", SaveFormat.Pptx);
}

See Also