HighlightText()

TextFrame::HighlightText(System::String, System::Drawing::Color) method

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

void Aspose::Slides::TextFrame::HighlightText(System::String text, System::Drawing::Color highlightColor) override

Arguments

ParameterTypeDescription
textSystem::StringText sample to highlight.
highlightColorSystem::Drawing::ColorHighlighting color.

TextFrame::HighlightText(System::String, System::Drawing::Color, System::SharedPtr<ITextHighlightingOptions>) method

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

void Aspose::Slides::TextFrame::HighlightText(System::String text, System::Drawing::Color highlightColor, System::SharedPtr<ITextHighlightingOptions> options) override

Arguments

ParameterTypeDescription
textSystem::StringText sample to highlight.
highlightColorSystem::Drawing::ColorHighlighting color.
optionsSystem::SharedPtr<ITextHighlightingOptions>Highlighting options.

Remarks

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

auto presentation = System::MakeObject<Presentation>(u"SomePresentation.pptx");
auto shape = System::ExplicitCast<Aspose::Slides::AutoShape>(presentation->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0));
// highlighting all words 'important'
shape->get_TextFrame()->HighlightText(u"title", System::Drawing::Color::get_LightBlue());
// highlighting all separate 'the' occurrences
System::SharedPtr<TextHighlightingOptions> textHighlightingOptions = System::MakeObject<TextHighlightingOptions>();
textHighlightingOptions->set_WholeWordsOnly(true);
shape->get_TextFrame()->HighlightText(u"to", System::Drawing::Color::get_Violet(), textHighlightingOptions);
presentation->Save(u"SomePresentation-out2.pptx", SaveFormat::Pptx);

See Also