HighlightText

HighlightText(string, Color)

Highlight all matches of sample in text frame text using specified color.

public void HighlightText(string text, Color highlightColor)
ParameterTypeDescription
textStringText sample to highlight.
highlightColorColorHighlighting color.

See Also


HighlightText(string, Color, ITextHighlightingOptions)

Highlight all matches of sample in text frame text using specified color.

public void HighlightText(string text, Color highlightColor, ITextHighlightingOptions options)
ParameterTypeDescription
textStringText sample to highlight.
highlightColorColorHighlighting color.
optionsITextHighlightingOptionsHighlighting options.

Examples

The following sample code shows how to Highlight Text in a PowerPoint Presentation.

[C#]
using (Presentation presentation = new Presentation("SomePresentation.pptx")){
	// highlighting all words 'important'
	((AutoShape)presentation.Slides[0].Shapes[0]).TextFrame.HighlightText("title", Color.LightBlue);
	// highlighting all separate 'the' occurrences
	((AutoShape)presentation.Slides[0].Shapes[0]).TextFrame.HighlightText("to", Color.Violet, new TextHighlightingOptions()
	{
		WholeWordsOnly = true
	});
	presentation.Save("SomePresentation-out2.pptx", SaveFormat.Pptx);
}

See Also